How to use regular expression replace for this special characters?
hi,
I need to replace the below string, but i couldnt able to do if we use the special charaters '+', '$' . can anyone suggest a way to do this?
select REGEXP_REPLACE('jan + feb 2008','jan + feb 2008', 'feb',1,0,'i') from dual
anwers should be :- feb
you should use escape character \.
the regular expression will look like as follows:
select REGEXP_REPLACE('jan + feb 2008','jan \+ feb 2008', 'feb',1,0,'i') from dual
hope this is what you needed.
cheers,
Davide
Similar Messages
-
Hi,
I have a file that contains this format (separated by ;(semicolon) ):
user id;user name;email address;password;integer;list of integer(separated by ,(comma))
below is the example data :
abc;Abc;[email protected];password1;1;1,2
def;Def;[email protected];password;2;1,2,3
ghi;Ghi;[email protected];password;2;1
my question is how to verify the valid input for each row using regular expression..? TQ@Op. Doing a correct validation of e-mailaddresses
is very hard using regular expressions (doingbasic
validation is however easy)
http://www.regular-expressions.info/email.html
I like the RFC 822 compliant regexp :) -
How to use regular expressions to generate test data ?
Hi
Someone can help me on what I have to do in order to create test data with regular expressions ?
For example, I want to introduce a random telephone number (XXX-XXXX) in the phone number Form Field, I want to create the phone number using regular expressions in order to test different values in each playback of the script.
I don't want to use VB or vbscript in e-tester, I'm just trying to do this with e-load nav editor and e-load
Thanks a lotHi and thanks for your answer!, it's a great trick ^_^
I'm doing a research on how to improve the execution speed of the scripts in e-load, so actually I'm trying to avoid the use of databanks and VB code also.
I was expecting that maybe e-load, e-load nav editor or e-tester can automatically generate test data via Regular Expressions. Someone Knows if this is possible ?
Also can anyone tell me what the option "Automatically Generated (complex)" means ? I think that this will help me a lot
*you can find this option in e-load Nav Editor when you select a parameter in the tree view, then go to the "type" listbox in the properties pane, there you will find this option and some more options like :"Databanked variable", "Custom Dynamic Value", "Function".. etc.
Thanks again -
How to use regular expression to delete a character?
Hello,
I have a query,
select partition_name from dba_tab_partitions where table_owner='xxx'and num_rows <>0 and table_name = 'xxx';
P5
P6
P7
P12
P13
P14
P17
P18
P19
P20
P24
How can I use regular expression in above SQL query to get result without letter 'P', like..
5
6
7
12
13
14
17
18
19
20
24
thank youI find answer...
select regexp_replace(partition_name,'P','')
thanks anyway -
How about the statement of regular expression like for this
I what to get varians String array by one regular express for the statement like:
${user} like play ${game} in ${date}
I want to get String[] as {"user","game","date"} by one regex, by str.split(regex). I tried many times but always fail to get the result I expected. May it be possible to meet the destination?
thanks in advance
Frederickwhy StringBuffer was using here?So one could split the pattern into multiple lines. But it just occurred to me that one could just use string concatenation, which would look better. I don't know why I bothered to use StringBuffefer.
e.g.:
String pattern =
"^" + // the start of a string
"(dog)|(cat)" + // match either "dog" or "cat" at the start of the line
"\\s*" + // match an arbitrary amount of whitespace
"$"; // but don't allow anything other than whitespace after dog or cat
Pattern p = Pattern.compile(pattern);
Pattern p = Pattern.compile("^(dog)|(cat)\\s*$");> isn't this look more simpler and better?
In this case, yes. I was looking for a way to make regexps more explicit, with whitespace and comments, for more complicated cases.
But those double quotes and plus signs add ugliness of their own, so a regexp would have to be pretty complex before it would be an improvement. -
How to use 'about' Contain operator for this string?
Hi all,
I need to search the following string in text index using about operator.
'Advertisment for Product(Cosmetic)'
How can I do this? If I use the following sql,
SELECT keyword_id
FROM keyword_text
WHERE contains(fts_text_uc, convert('about(Advertisment for Product(Cosmetic))',
'WE8MSWIN1252', 'WE8MSWIN1252')) > 0
ORDER BY nlssort(text, 'NLS_SORT=EEC_EUROPA3')
It gives following error.
ORA-29902: error in executing ODCIIndexStart() routine
ORA-20000: Oracle Text error:
Any body know how to write query for this?
Thanx in advance
T.UmapathyYou'll need to quote the parantheses by putting backslashes in front of them:
select text from t where contains (text, convert('about(Advertisement for Product\(Cosmetic\))', 'WE8MSWIN1252', 'WE8MSWIN1252')) > 0 -
How to use regular expression to find string
hi,
who know how to get all digits from the string "Alerts 4520 ( 227550 ) ( 98 Available )" by regular expression, thanks
br, AndrewLiu,
You can use RegEx as
d+
Whether you are using CL_ABAP_REGEX class then
report zars.
data: regex type ref to cl_abap_regex,
matcher type ref to cl_abap_matcher,
match type c length 1.
create object regex exporting pattern = 'd+'
ignore_case = ''.
matcher = regex->create_matcher( text = 'Test123tes456' ).
match = matcher->match( ).
write match
You can find more details regarding REGEX and POSIX examples here
http://www.regular-expressions.info/tutorial.html
a® -
How to use regular expression in editor?
I tried to add some text to all line in selected text in editor
ie .
x:= x+1 ; change to x:=x+1; log_something;
y:= y-1; -> y:= y-1 ; log_something;
and so on.
Then
1. select some text in editor
2.pressed Ctrl-R
3.in "text to search for" I put "^\(.*\)$"
4.in "replace with" I put "\1 log_something;
5.check "Regular expressions"
6. check "Selected text only"
I got "The search text "^\(.*\)$" was not found."
What am I doing wrong?Thanks. But now editor wants to replace whole text, not only selected by me, regardless of <<check "Selected text only" >>
Update: if I pick "scope: all" instead of "prompted" it shows popup "text not found" but replaces text as requested.
Message was edited by: user4879976 -
How to do a string replacement with a special characters?
Hi there, I've a string which I need to do a replacement in but replaced and/or replacement contain a special chars.
I.e. like this:
newConvertedString = newConvertedString.replaceAll("</soapenv:Body>", "");
newConvertedString = newConvertedString.replaceAll("<default:edit-config>", "</default:edit-config>");
It does not do anything. I know that repalceAll(regexc., regexp.) but what can I use instead??
Thanks ina advanceqavlad wrote:
Thanks 'jverd'. Just one more question - do you know if there any limit on the replacement string/regex used with/in .replaceAll()??No, the only limit would be the limit on how big a string can be and how much memory you have. However, anpoorly written regex on a long String will take a long time to execute.
Seems like when I'm trying to replace one like this (and even a longer ones) it does not replace anything while it's there.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header><wsse:Security xmlns:wsss="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wssa="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
Then there was no match. -
How to use regular expression using pattern and match concept for this scenario?
Hi Guys,
I have a string "We have 7 tutorials for Java, 2 tutorials for Javascript and 1 tutorial for Oracle"
I need to replace the numbers based on the below condition.
if more then 5, replace with many
if less then 5, replace with a few
if it is 1, replace with "only one"
below is my code, I am missing the equating part to replace the numbers could any one of you please help me out fixing this.
private static String REGEX="(\\d+)";
private static String INPUT="We have 7 tutorials for Java, 2 tutorials for Javascript and 1 tutorial for Oracle";
//String pattern= "(.*)(\\d+)(.*)";
private static String REPLACE = "replace with many";
public static void main(String[] args) {
// Create a Pattern object
Pattern r = Pattern.compile(REGEX);
// Now create matcher object.
Matcher m = r.matcher(INPUT);
//replace the value 7 by the replace string
//How to equate the (\\d+) greater than a number and use it the below code.
INPUT = m.replaceAll(REPLACE);
//Print the final Result;
System.out.println(INPUT);
Thanks and Regards,Hi,
Try the following which makes use of "appendReplacement" instead with the "start" and "end" methods to locate and check the searched "regExp" string before dynamically setting the "replace" string:
String regExp = "\\d+";
String input = "We have 7 tutorials for Java, 2 tutorials for Javascript and 1 tutorial for Oracle";
String replace;
Pattern p = Pattern.compile(regExp);
// get a matcher object
Matcher m = p.matcher(input);
StringBuffer sb = new StringBuffer();
while (m.find()) {
Integer x = Integer.valueOf(input.substring(m.start(), m.end()));
replace = (x >= 5) ? "many" : (x == 1) ? "only one" : "few";
m.appendReplacement(sb, replace);
m.appendTail(sb);
System.out.println(sb.toString());
HTH.
Regards,
Rajen
P.S: Please mark the post as answered/helpful if it resolves your issue for the benefit of all community members. -
How can I use regular expression to match this rule
I have a String ,value is "<a>1</a><a>2</a><a>3</a>",and want to match other String like "<a>1</a><a>8</a>",if the one of the first string(like "<a>1</a>") will occur in the second string,then will return true.but I don't know how to write the regular expresstion.
ThxFine fine. :P
I was a little bored, so here's some code that uses Strings and a StringBuffer (though you could use a String in place of the StringBuffer). Is this perhaps better? :)
String testMain = "<a>1</a><ab>2</ab><ab>3</ab>";
String test = "<ab>1</ab><ab>3</ab>";
String open = "<ab>";
String close = "</ab>";
StringBuffer search = new StringBuffer();
String checkString = null;
int lastCheck = 0;
int start = 0;
int finish = 0;
boolean done = false;
while (!done) {
start = test.indexOf(open);
finish = test.indexOf(close);
if ((start == -1) || (finish == -1)) {
System.out.println("No more tags to search for.");
done = true;
else {
checkString = test.substring((start + open.length()), finish);
search = new StringBuffer();
search.append(open);
search.append(checkString);
search.append(close);
if (testMain.indexOf(search.toString()) != -1) {
System.out.println("Found value: " + checkString);
test = test.substring(finish + close.length());
Resulting output:
Found value: 3
No more tags to search for.
-G -
How to use time series functions for this requirement
we are on OBIEE 11g (11.1.1.5)
Any pointers and links are really helpful.
I have a requirement where YTD sales are displayed in a column. We wan to compare that number to what that number was last year at the same time. Tried to use TODATE, AGO and it did not work.
|| used for column seperation below.
ProductGroup || YTD Sales Rev||YTD Sales Rev 1 Year Ago||YTD Sales Rev 2 Years Ago
Climate Solutions || 1.7 mil (1/1/2011 - 7/1/2011) || 1.45 mil (1/1/2010 - 7/1/2010) || 1.15 mil (1/1/2009 - 7/1/2009)
Thanks in advance
kris
Edited by: user566193 on Aug 10, 2011 6:06 PMKris,
Basically you want to combine the 2 time series functions here i.e. TODATE & AGO.
Here you go..
You can create first a YTD logical column in BMM say YTD Sales Rev..Then create another logical column with calculation as AGO(YTD Sales Rev, YEARDIM, 1) or AGO(YTD Sales Rev, MONTHDIM, 12).
Similarly, you create other measures...OBIEE 11g has time series function in Answers as well but I'd say try to create using RPD as you to calculate 1 logical column based on another. Better to push it on RPD side.
Hope this helps -
How do use a cross tab for this ?
Hi,
I have the following details :
Sn idType cnt1 cnt2
1 test1 11 22
1 test2 2 4
2 test1 33 2
2 test2 3 4
i need to show it as
Sn test1cnt1 test1cnt2 test2cnt1 test2cnt2
1 11 22 2 4
2 33 2 3 4
how can i do that using analytic function ?
kindly advise
tks & rdgsHi ,
managed to do something like this :
select lotid ,
sum(decode(a.type , 'cp1' , cnt)) type1Cnt ,
sum(decode(a.type , 'cp1' , yield)) type1Yield ,
sum(decode(a.type , 'cp2' , cnt)) type2Cnt ,
sum(decode(a.type , 'cp2' , yield)) type2Yield
from testing a
group by lotid
results :
LOTID TYPE1CNT TYPE1YIELD TYPE2CNT TYPE2YIELD
1 lotid1 22 33 2 4
2 lotid2 5 6 7 11
but would a analytic function be able to do that ?
appreciate ur advise
tks & rdgs -
How to use Find and Replace for CR or TAB
How can I use PAGES 'Find and Replace' function to eliminate unwanted carriage returns or Tabs?
I tried to copy the backwards P and paste into Pages find window, but that doesn't work.
eMac Mac OS X (10.4.4) 1 G RAMCopying & pasting should work, but it isn't necessary. In the Find & Replace fields hold down the Option key & hit the return or tab key.
Peggy -
How to use regular expressions
Hey ,
I found my self getting troubled with using regex in java.
I know that in order to use regex, i need to import two classes
import java.util.regex.Matcher;
import java.util.regex.Pattern;
but I become entangled with the implementation.
I need to check if inserted string contains a number inside, so i build a pattern of regex. and compiled it. then i used matcher method. but from here all methods i use, i'm getting only the first digit of the number. ---> "sdasda25" i'm getting (after using group() ) only the digit 2.
is there any method that i can pass over all chars in the string (by loop) and to check if that particular char isMatch for my pattern (That's the way to implement it in C#, and i thought that here it will be the same...).
Tanxboth of you were right, I didnt write a '+' at the end of my pattern
thank you both
Maybe you are looking for
-
How can I take a Black and White photo and make ONE item (lets say flowers) and make that red?
-
Auto submit input text doesnt show message after enter
I have a page in jdeveloper 11 an input text with the attribute autosubmmit=true... When I write error entrance in the inputtext and press enter, the message is shown and the alert is given. but if I press enter again, the alert message disappears. W
-
MM Transfer material UNBW with movement types
Dear friends ! I would like to know if is it possible to transfer material UNBW thru MM ? Could I use movement type 303 - 305 or 641 and 101 ? best regards Ale
-
Hi PP Gurus, Can anybody guide me about how to configure Digital Signature for ECR - ECO? I need to give R/3 UserID and Password for each step of ECR - ECO like for checking ECR - Engg Head Approving ECR - Quality Head Converting ECR - Production Hea
-
Cant find BI Content Objects..
Hi Friends, I am unable to find any SAP Delivered Objects under Business Content ( ex :Busines Content Cubes , ODS, InfoObjects , BC Reports... etc) I can see only Technical Content Objects Its really urgent to me.. Do i need to do any Configuratio