URGENT : replacing letters in an expression
Hi all
I think that I should post this topic here because I think it concerns SQL functions. Here is the problem :
I am developping a forms application . There is a listbox named FORMULA containing list of formulas. When I choose a formula from that list then there is a program which exctracts all of its operands. For example if the formula is : (a+b)*abs(c-d) then the operands are : a,b,c and d.
Then I populate another listbox named OPERANDS with these operands. So the value of the OPERANDS listbox is either a or b or c or d in our example.
I held the expression of the formula in a global variable so it can be accessible anywhere in my application.
When I choose one of the operands from the OPERANDS listbox , for example b,then I enter its value , for example 5, in a text field named VALUE ,and then I click on a button to replace the letter "b" in the formula with the value I entered , which is 5. So I want to get an expression like this : (a+5)*abs(c-d) .
But the problem is that when I run the application then all letters "b" in the formula are replaced by 5 . So even the expression "abs", which is a pl/sql function, is replaced by "a5s". And I do not want that to happen.
Here is how I proceeded :
formula := replace(formula,operands,value); where "formula" is the global variable containing the formula expression, "operands" is the variable containing the value of the OPERANDS listbox which is "b" here, and "value" is the variable containing the value 5.
So how can I avoid this misreplacement ?
Thank you very much indeed.
post it where you want, but only once...
I will follow the other thread
URGENT : replacing some letters in an expression
Similar Messages
-
"Replace letters with" function
How to tell Mail to use "Replace letters with" function of Keyboard/text? All other apps are using this!
Thanks,
Matyasyou can create your own replaceString function;
i.e.
http://www.worlddeveloper.org/www/forumtopicview.html?fid=167&categoryId=24&fpn=0 -
Email Messages Replacing Letters With = Signs
Somebody please help I am having an issue with my z10. When I send an email from my device is adds a bunch of script into the email that should not be there. It even goes as far as replacing letters I have put in with = signs and a bunch of other random stuff. Such as =/div>, =/body>, rev&n=sp. I am not sure what is going on here but it is really messing up my emails. Can someone help?
Same here. In my case the same email when read on another smartphone does not contain these artifacts. The BB is obviously mis-encoding something that our email clients (Outlook in my case) are sensitive to.
What about you? Trashed only in Outlook or something like that, or also when read back on another mobile device? -
Adobe Pro XI deletes and/or replaces letters with blank spaces or an x
How do I fix the problem where Adobe Pro XI deletes and/or replaces letters with blank spaces or an x.
This is really annoying to have to go back to each thing I type into a document and re-choose the fonts to get them to be correct.
Thanks for your help!Adobe is a company, not a program... do you mean ACROBAT Pro?
If yes, this is the Premiere Pro video editing forum, you need to go to http://forums.adobe.com/community/acrobat -
URGENT : replacing some letters in an expression
Hi all
I think that I should post this topic here because I think it concerns SQL and PL/SQL functions. Here is the problem :
I am developping a forms application . There is a listbox named FORMULA containing list of formulas. When I choose a formula from that list then there is a program which exctracts all of its operands. For example if the formula is : (a+b)*abs(c-d) then the operands are : a,b,c and d.
Then I populate another listbox named OPERANDS with these operands. So the value of the OPERANDS listbox is either a or b or c or d in our example.
I held the expression of the formula in a global variable so it can be accessible anywhere in my application.
When I choose one of the operands from the OPERANDS listbox , for example b,then I enter its value , for example 5, in a text field named VALUE ,and then I click on a button to replace the letter "b" in the formula with the value I entered , which is 5. So I want to get an expression like this : (a+5)*abs(c-d) .
But the problem is that when I run the application then all letters "b" in the formula are replaced by 5 . So even the expression "abs", which is a pl/sql function, is replaced by "a5s". And I do not want that to happen.
Here is how I proceeded :
formula := replace(formula,operands,value); where "formula" is the global variable containing the formula expression, "operands" is the variable containing the value of the OPERANDS listbox which is "b" here, and "value" is the variable containing the value 5.
So how can I avoid this misreplacement ?
Thank you very much indeed.select
e,
regexp_replace(
regexp_replace(e,
'([^[:alnum:]_]|^)b([^[:alnum:]_(]|$)','\15\2'
),'([^[:alnum:]_])b([^[:alnum:]_(]|$)','\15\2'
) "EXP"
from
(select '(a+b)*abs(c-d)' e from dual
union select 'b+b' from dual
union select 'b+b+b+b' from dual
union select '1-b(b)' from dual)
E EXP
(a+b)*abs(c-d) (a+5)*abs(c-d)
1-b(b) 1-b(5)
b+b 5+5
b+b+b+b 5+5+5+5If you do not have 10g, you can look at the OWA* packages or write you own function
Regards
Laurent -
Replace All with Regular Expression
Hi all,
I need a help to replace the String:
to
"<a href=\"1\"">Java Programming</a>"
I was trying to replace with
.replaceAll("\\[\\[*([^\\]]*?)*\\]\\]", "<a href=\"\"></a>")
but I don't know how to separate the parameters values.
Best regardsHi prometheuzz,
you are the one!!
But how I could do to a Srting like this:
Ah, more requirements...
Things are getting a bit messy now:
import java.util.regex.Matcher;
import java.util.regex.Pattern;
class Main {
public static void main(String[] args) {
String line = "any text any text any text any text any text. "+
"Click - [[Code: 6 Title: Java Programming]]. "+
"any text any text any text any text any text. "+
"- [[C�digo: 2 T�tulo: Sun]] text text "+
"any text any text any text any text any text.";
String newLine = line;
String[] wikiTags = getWikiTags(newLine);
for(String tag : wikiTags) {
String newTag = "<a href=\""+get("(Code:|C�digo:)", " ", tag)+
"\">"+get("(Title:|T�tulo:)", "$", tag)+"</a>";
newLine = newLine.replaceFirst("\\[\\["+tag+"\\]\\]", newTag);
System.out.println(line);
System.out.println(newLine);
public static String[] getWikiTags(String text) {
java.util.List<String> list = new java.util.ArrayList<String>();
Pattern pattern = Pattern.compile("(?<=\\[\\[)(.*?)(?=\\]\\])");
Matcher matcher = pattern.matcher(text);
while(matcher.find()) {
list.add(matcher.group());
return list.toArray(new String[list.size()]);
public static String get(String start, String end, String text) {
Pattern pattern = Pattern.compile("(?<="+start+"\\s)(.*?)(?="+end+")");
Matcher matcher = pattern.matcher(text);
return matcher.find() ? matcher.group() : "#ERROR#";
}Details about regex:
http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
http://www.regular-expressions.info/java.html
http://java.sun.com/docs/books/tutorial/essential/regex/
>
Thanks a lot for you helpLike I said, it's a bit of a messy solution. See if you can use (a part of) it.
Good luck. -
Replace string with regular expression
I am new to the regular expression. I am just trying to remove double quotes from a string.
My sample string is sql statement(SELECT "SCHEMA"."TABLE1"."COLUMN1", "SCHEMA"."TABLE1"."COLUMN2" FROM "SCHEMA"."TABLE1", "SCHEMA"."TABLE2" WHERE "SCHEMA"."TABLE1"."COLUMN1" = "SCHEMA"."TABLE2"."COLUMN1" );
This is what I came up with.
String s = query.replaceAll("\\.\"", ".").replaceAll("\"\\.", ".").replaceAll("\\s\"", " ").replaceAll("\\s\"", " ").replaceAll("\",", ",").replaceAll("\"\\s", " ");
But I want to optimize this line.
Could anybody tell me how to call replaceAll once with using regular expression instead of calling replaceAll multiple times? Some table or column names can have double quotes, so I want to remove the double quotes without replacing the double quotes which is part of the table or column name.
I'd appreciated it.caesarkim1 wrote:
I am new to the regular expression. I am just trying to remove double quotes from a string.
My sample string is sql statement(SELECT "SCHEMA"."TABLE1"."COLUMN1", "SCHEMA"."TABLE1"."COLUMN2" FROM "SCHEMA"."TABLE1", "SCHEMA"."TABLE2" WHERE "SCHEMA"."TABLE1"."COLUMN1" = "SCHEMA"."TABLE2"."COLUMN1" );
This is what I came up with.
String s = query.replaceAll("\\.\"", ".").replaceAll("\"\\.", ".").replaceAll("\\s\"", " ").replaceAll("\\s\"", " ").replaceAll("\",", ",").replaceAll("\"\\s", " ");
...Note that the following two lines are equivalent:
s = s.replaceAll("a","").replaceAll("b","");
s = s.replaceAll("a|b",""); -
Replacement CDs for Logic Express
Hi,
Bought Logic Express a while back and I've lost the CDs and the box and all. All I have is the software installed and the manual. Is there any way Apple could me with this? Has anyone dealt with something like this before?
I desperately need the CDs just in case... and I don't feel like buying a whole new package.
BSorry to say this, but there is nothing apple can do. Don't ask us, we're not apple. Ask apple, they may be able to do something, but I highly doubt they will replace the CDs for you.
Matt -
When Apple TV comes out will it replace need for Airport Express?
Hello,I have a couple questions:
1.) If I want to play iTunes through my stereo will I be able to use Apple TV for this? Or should I buy Airport Express.
2.) Can I use Airport Express or Apple TV for DVD player? Does the signal have to come through iTunes?
Thanks to anyone who knows these answers.
Powerbook G4 Mac OS X (10.4.2)1.) If I want to play iTunes through my stereo will I be able to use Apple TV for this? Or should I buy Airport Express.
You should ask in the Apple TV discussion area if the Apple TV has the features that you want (i.e. remote music streaming). From the description it does not appear to have this functionality.
2.) Can I use Airport Express or Apple TV for DVD player?
Since neither the Apple TV nor AirPort Express (AX) have an optical drive they can't be used directly as a DVD player.
Does the signal have to come through iTunes?
Take a look at Airoil. -
Replacing an older Airport Express with an N
My older Airport Express was used primarily for streaming music to a stereo system which was intermittently dropping out. Since proximity wasn't an issue it was suggested to upgrade to the N version.
After installing the Disc Version 1.5 and plugging in the new Airport Express, which is currently blinking amber, it doesn't show up in the Utility menu. The old unit shows up in the Utility menu when reinstalled.
Am I missing a fundamental step to introduce the new Airport Express unit into the network?Vic,
I see you have multiple computers handy.
Have you tried any of your other computers using Airport Utility to find your new AX?
The new AX should show up as a new Base Station and be ready to configure unless something is wrong with it.
Some people like to attach ethernet cables to it to get started but I am not found of that.
I have owned 3 of the older "g" models and now 3 of the newer "n" models. Plus I have set up more AX's then I can count. Never had a problem.
If it can't be found wirelessly, then I would take it back.
However, first try some of your other computers and see if you can find the new AX... -
Urgent help regarding Java regular expressions.
hello everyone,
I am trying to parse a html file which contains
dyn.Img("http://www.boston.com/news/nation/articles/2007/06/21/bill_clinton_takes_bigger_campaign_role&h=306&w=410&sz=13&hl=en&start=43","","QFo9lqKeMR7uzM:","http://cache.boston.com/resize/bonzai-fba/AP_Photo/2007/06/21/1182410228_1931/410w.jpg","125","93","\x3cb\x3eBill Clinton\x3c/b\x3e takes bigger campaign \x3cb\x3e...\x3c/b\x3e","","","410 x 306 - 13k","jpg","www.boston.com","","","http://tbn0.google.com/images","1")
the given above function many times. I have to fetch the whole functions into an array. So i have to write a regular expression which recognises the whole above string.
Can anyone please help me.
Thank you,
chaitanyawell if this is all you want
http://cache.boston.com/resize/bonzai-fba/AP_Photo/2007/06/21/1182410228_1931/410w.jpg
You can always substring it like chuck said
***BUT all the images would have to be .jpg for this to work***
back = we.indexOf(".jpg");
int x = 0;
while (back < web.lastIndexOf(".jpg"))
back = web.indexOf("http",back+1);
picture[x] = web.substring(front, back);
x++;
front = back;
} Might not be the best code but it worked with a website i had to parse
Message was edited by:
mark07 -
I am running OSx 10.6.8 and downloaded the utility version 5.6.1.
Using the new utility, and setting it up as a new network, it finds and sets up the time capsule part just fine, I was able to start a backup, so it looked it was working ok.
But when it comes to the wireless part, the utility says it was set up correctly, but I do not get any response from the Internet.
I have the ability to connect to the original airport express based network, so I am not net less at the moment.
But whenever I try to connect to the new network via the AirPort Extreme, does not work. What am I missing?The new AC version TC requires v6 airport utility.. so you need at least Lion running on the computer to do the setup.
5.6 utility will not do the setup correctly.
You can also use the airport utility for iOS if you have a recent iphone/ipad.. -
Replacing letters through StreamTokenizer
Hi,
I am writing a program which reads from a text file, passes it into a StreamTokenizer, looks for a particular word and capitalises the first letter (in this case "apples" to "Apples"). It's all fine, except when the word I'm looking for appears in the middle of a sentence, in which case, it seems to ignore it completely. I'm probably doing something really stupid, but I'd appreciate it if anyone could help me!
Input file:
John likes apples. apples are healthy.
The apples John eats are red, sometimes green. Most
apples come from farms.
Current output file:
John likes apples. Apples are healthy.
The apples John eats are red, sometimes green. Most
apples come from farms.
What output file is supposed to be:
John likes Apples. Apples are healthy.
The Apples John eats are red, sometimes green. Most
Apples come from farms.
Code:
//Filename:FileReader.java
import java.io.*;
public class FileReader
public static void main(final String[]Args) throws IOException, FileNotFoundException
//declares and instantiates the array aFileNames
String[] aFileNames = new String[3];
//read in the input & output file names and places them into an array
for(int tArgNames = 0; tArgNames < Args.length; tArgNames ++)
aFileNames[tArgNames] = Args[tArgNames];
//instantiates a buffered reader
BufferedReader tTextIn = new BufferedReader(new FileReader(aFileNames[0]));
//declares and instantiates a stream tokenizer
StreamTokenizer tStreamTokens = new StreamTokenizer(tTextIn);
//declares a print writer for output file
PrintWriter tTextOut = null;
//instantiates the print writer for output file
tTextOut = new PrintWriter(new FileWriter(aFileNames[1]));
//declares a print writer for log file
PrintWriter tTextLog = null;
//instantiates the print writer for log file
tTextLog = new PrintWriter(new FileWriter(aFileNames[2]));
//Writes name of files being opened to log file
tTextLog.println("File being opened: " + aFileNames[0]);
tTextLog.println("File being opened: " + aFileNames[1]);
//Line counter variable
int tWordCounter = 0;
//Word counter variable set at -1 to account for eof
int tLineCounter = -1;
//Recognises punctuation
tStreamTokens.wordChars('.', '.');
tStreamTokens.wordChars(',', ',');
tStreamTokens.wordChars('\'', '\'');
tStreamTokens.eolIsSignificant(true);
//while there are more lines of text in the file
while(tStreamTokens.nextToken() != StreamTokenizer.TT_EOF)
//if the stream token is a string
if(tStreamTokens.ttype == StreamTokenizer.TT_WORD)
//and if the token value is "apples"
if(tStreamTokens.sval.equals("apples"))
//change the stream token to "Apples"
tStreamTokens.sval = ("Apples");
tTextLog.println("Word changed at Line " + tStreamTokens.lineno());
//increment the word counter
tWordCounter++;
//if the end of the line has been reached, increment the line counter
else if(tStreamTokens.ttype == StreamTokenizer.TT_EOL)
tStreamTokens.sval = ("");
tTextOut.println("");
tLineCounter ++;
tTextLog.print("End of line reached. Word Count: " + tWordCounter + " . ");
tTextLog.println("Line Count: " + tLineCounter);
//writes the current token to the output file named in the command line
tTextOut.print(tStreamTokens.sval + " ");
//prints the values to the designated output file
tTextOut.println("Name of input file: " + aFileNames[0]);
tTextOut.println("Number of lines: " + tLineCounter);
tTextOut.println("Number of words: " + tWordCounter);
//prints the values to the command prompt
System.out.println("Name of input file: " + aFileNames[0]);
System.out.println("Number of lines: " + tLineCounter);
System.out.println("Number of words: " + tWordCounter);
//prints the values to the log file
tTextLog.println("Total Number of Lines: " + tLineCounter);
tTextLog.println("Total Number of Words: " + tWordCounter);
//Writes name of files being closed to log file
tTextLog.println("File being closed: " + aFileNames[0]);
tTextLog.println("File being closed: " + aFileNames[1]);
//Closes the files
tTextIn.close();
tTextOut.close();
tTextLog.close();
}Apologies for the not-very-nice code. I'd be grateful for any help on this.
Cfor one, you might want it to check for "apples."Thanks for your help! I thought I was already
checking, here:
//and if the token value is "apples"
if(tStreamTokens.sval.equals("apples")) ///<--here
//change the stream token to "Apples"
tStreamTokens.sval = ("Apples");
tTextLog.println("Word changed at Line " +
+ tStreamTokens.lineno());
}but I'll have to look into it some more.
C
maybe you should read the post again. you need to check for the period too, dork.
if(tStreamTokens.sval.equals("apples")) {
//change the stream token to "Apples"
tStreamTokens.sval = ("Apples");
tTextLog.println("Word changed at Line " + tStreamTokens.lineno());
}should be something like
if(tStreamTokens.sval.equals("apples")) {
//change the stream token to "Apples"
tStreamTokens.sval = ("Apples");
tTextLog.println("Word changed at Line " + tStreamTokens.lineno());
}else if(tStreamTokens.sval.equals("apples.")) {
//checking for "apples." also
tStreamTokens.sval = ("Apples.");
tTextLog.println("Word changed at Line " + tStreamTokens.lineno()); -
Iphone 3GS has "169..." IP address after replacing old Airport Express
My 3GS is no longer connecting to my home network after replacing my old airport express.
Previously my old G5 iMac would have problems connecting to the old airport express, BUT my iPhone 3GS would reliably connect.
After installing this new airport express, my iMac is on the network, but NOW my iPhone 3GS is experiencing the same problem my iMac previously had: IP address changed to 169.254.205.191
Airport Express is set to WPA2 Personal
Updated firmware on the Airport express
Network settings on iphone have been reset several times.
Airport express has been rebooted several times.
Please help. Thank you.Thnx William but that is not the case coz all other devices(laptops, desktops, PS3...etc) r working just fine.
after alot of time trying to figure out what the problem is I figured out the problem but cant seem to sove it:
I have three router in my network one acts as a DHCP server (router 1) and the others act as AP, they all brodcast wirless (SSID) based on the internet connection coming from router 1, all devices including my old iphone 3g connect on all three router no problem and get assigned an ip address within range 192.168.1.~, however when i connect my 3gs to router 1 (DHCP) it works perfectly and connects to the internet but when I connect to any of the other routers I cannot have internet access and it takes a long time to show the wi-fi symbol (3 bars), I managed to overcome this by giving my second router another network IP i.e 192.168.2.~ and made it aother DHCP server (but another network) that way my 3gs connected just fine like the 1st router, the problem with this solution is that I am on two seperate networks but same internet feed so I cannot communicate between lapto, desktop, PS3...etc
I guess I have two options:
1- wait for an update for 3gs hoping this could be solved and keep my network as is.
2- assign three different networks just for 3gs to work and sacrifice my whole home sharing.
SOOOO Pleaseeeeee if anything know anything or could help me in anyway please and post, is it just me or have i heared alot of Wi-Fi problems with 3gs!!! -
Replacing characters in a string - URGENT!
Hi guys
I have a string - 003452.jpg.xml
I want to remove the '.jpg'
How do I do this ... I was using :
String image1 = 002452.jpg.xml;
String newString = image1.replace ( '.jpg',' ' );
What am i doing wrong???
thanksThe replace method takes characters as its arguments not strings. If you files will always be in that format you can do something like:
In j2se 1.4 a replace based on regular expressions was added so you could use:
String image1 = "002452.jpg.xml";
String newString = image1.replaceAll ("\\.jpg", "" );
Maybe you are looking for
-
I have a 2013 Buick Enclave with Pandora and Stitcher on the nav screen. With my Samsung S3, Pandora automatically lit up and worked. with new iphone5, I was told I need to connect USB port to car and phone and start Pandora. That worked and the icon
-
Problem in Form builder when calling layout tabstrip
Hello @all, The last days all work great, but since today when i call the layout tabstrip in transaction. There comes the error message popup : Adobe LiveCycle Designer ES has encountered a problem and needs to close. We are sorry for the inconvenie
-
I suspect I will be able to use the sidebar to organize my bookmarks, just like organize bookmarks used to work, now that I have found this out. But, it took me many tries over a month, to get the answer, and about 20 minutes just now. So, this is ju
-
Processing messages from MQ by JMS adapter
Hi, I have a JMS adapter which reads messages from MQ and invokes a real time service. I am facing a problem. Suppose after processing my 3rd message fails , i get the error com.acta.adapter.sdk.RecoverableOperationAdapterException: JMS GET OPERATION
-
Still need help with changing hostname on Solaris 10
Hello. I have some difficulties with changing host name of my computer. It is DHCP Client. AS I understand there are the following steps that I have to do: 1. Edit the /etc/default/dhcpagent file and change the line that reads the following: #REQUEST