Need advice on negating a whole string line with regular expression

Hi All,
I am not able to ignore / get rid of the following line even though my Java 6 (Windows XP) String Pattern matching has not taken cater for it:
*% Cleared: 61%*
Below is the existing Java String Pattern matching in the simple program:
Pattern pattern = Pattern.compile("(^.*[A-Z][a-z]*){1,2} \\d{0,4}/?\\d{0,4} ([A-Z][a-z]*){1,2} St|Rd|Av|Sq|Cl|Pl|Cr|Gr|Dr|Hwy|Pde|Wy|La \\d br [h|u|t] \\$\\d+,\\d+|\\$\\d*\\,\\d+,\\d+ ([A-Z][a-z]*){1,}.*$");This pattern is working for valid strings.
The following pattern has included "^(?!.*\.\.).*$" into the existing one but had no luck still:
Pattern pattern = Pattern.compile("^(?!.*\.\.).*$|((^.*[A-Z][a-z]*){1,2} \\d{0,4}/?\\d{0,4} ([A-Z][a-z]*){1,2} St|Rd|Av|Sq|Cl|Pl|Cr|Gr|Dr|Hwy|Pde|Wy|La \\d br [h|u|t] \\$\\d+,\\d+|\\$\\d*\\,\\d+,\\d+ ([A-Z][a-z]*){1,}.*$)");This picked up other rubbish including "*% Cleared: 61%*".
I am looking for a single regular expression that applies to the whole line.
I am quite new to regular expression but has read through Regular Expressions Cookbook (Oreilly - 2009) and is still not familiar with advance functions such as lookahead / lookbehind...
Your assistance would be appreciated.
Thanks,
Jack

Hi Winston,
I am still digesting the material from the regular expression book and will take sometime to become proficient with it.
It seems that using groupCount() to eliminate the unwanted text does not work in this case, since all the lines returned the same value. Ie 3 posted earlier. This may be because the patterns are complex and only a few were grouped together. Otherwise, could you provide an example using the string posted as opposed to a hyperthetic one. In the meantime, at least one solution have been found by defining an additional special pattern “\\A[^%].*\\Z”, before combining / intersecting both existing and the new special pattern to get the best of both world. Another approach that should also work is to evaluate the size of String.split() and only accept those lines with a minimum number of tokens.
Anyhow, I have come a crossed another minor stumbling block in the mean time with the following line, where some hidden characters is preventing the existing pattern from reading it:
o;?Mervan Bay 40 Boyde St 7 br t $250,000 X West Park AE
Below is the existing regular expression that works for other lines with the same pattern but not for special hidden characters such as “o;?”:
\\A([A-Z][a-z]*){1,2} [0-9]{0,4}/?[0-9]{0,4}-?[0-9]{0,4} ([A-Z][a-z]*){1,2} St|Rd|Av|Sq|Cl|Pl|Cr|Gr|Dr|Hwy|Pde|Wy|La [0-9] br [h|u|t] \\$\\d+,\\d+|\\$\\d*\\,\\d+,\\d+ ([A-Z][a-z]*){1,}\\ZIs it possible to come up with a regular expression to ignore them so that this line could be picked up? Would also like to know whether I could combine both the special pattern “\\A[^%].*\\Z” with existing one as opposed to using 2 separate patterns altogether?
Many thanks,
Jack

Similar Messages

  • Match beginning of line with Regular Expression

    I'm confused about dreamweaver's treatment of the characters
    ^ and $ (beginning of line, end of line) in regex searches. It
    seems that these characters match the beginning of the file, not
    the beginning of the various lines in the file. I would expect it
    to work the other way around. A search like:
    (^.)
    should match every line in the file, so that a find/replace
    could be performed at the beginning of each line, like this:
    HELLO$1
    which would add 'HELLO' at the start of each line in the
    file.
    Instead, this action only matches the first character of the
    file, sticks 'HELLO' in front of it, and then quits (or moves on to
    the next file). The endline character $ behaves in a similar
    fashion, matching only the end of the file, not the end of each
    line.
    I've searched, and all the literature about regular
    expressions in dreamweaver seems to indicate that I'm expecting the
    correct behavior:
    www.adobe.com/devnet/dreamweaver/articles/regular_expressions_03.html
    quote:
    ^ Beginning of input or line ^T matches "T" in "This good
    earth" but not in "Uncle Tom's Cabin"
    $ End of input or line h$ matches "h" in "teach" but not in
    "teacher"
    Thanks for any insight, folks.

    Hi Winston,
    I am still digesting the material from the regular expression book and will take sometime to become proficient with it.
    It seems that using groupCount() to eliminate the unwanted text does not work in this case, since all the lines returned the same value. Ie 3 posted earlier. This may be because the patterns are complex and only a few were grouped together. Otherwise, could you provide an example using the string posted as opposed to a hyperthetic one. In the meantime, at least one solution have been found by defining an additional special pattern “\\A[^%].*\\Z”, before combining / intersecting both existing and the new special pattern to get the best of both world. Another approach that should also work is to evaluate the size of String.split() and only accept those lines with a minimum number of tokens.
    Anyhow, I have come a crossed another minor stumbling block in the mean time with the following line, where some hidden characters is preventing the existing pattern from reading it:
    o;?Mervan Bay 40 Boyde St 7 br t $250,000 X West Park AE
    Below is the existing regular expression that works for other lines with the same pattern but not for special hidden characters such as “o;?”:
    \\A([A-Z][a-z]*){1,2} [0-9]{0,4}/?[0-9]{0,4}-?[0-9]{0,4} ([A-Z][a-z]*){1,2} St|Rd|Av|Sq|Cl|Pl|Cr|Gr|Dr|Hwy|Pde|Wy|La [0-9] br [h|u|t] \\$\\d+,\\d+|\\$\\d*\\,\\d+,\\d+ ([A-Z][a-z]*){1,}\\ZIs it possible to come up with a regular expression to ignore them so that this line could be picked up? Would also like to know whether I could combine both the special pattern “\\A[^%].*\\Z” with existing one as opposed to using 2 separate patterns altogether?
    Many thanks,
    Jack

  • String splitting with regular expressions

    Hello everyone
    I need some help in splitting the string using regular expressions
    Suppose my String is : abc def "ghi jkl mno" pqr stu
    after splitting the reulsting string array should contain the elements
    abc
    def
    ghi jkl mno
    pqr
    stu
    what my regular expression should be

    Since this is essentially the same as parsing CSV data, you might want to download a CSV parser and adapt it to your need. But if you want to use regexes, split() is not the way to go. This approach should work for your sample data:
    Pattern p = Pattern.compile("\"[^\"]*+\"|\\S+");
    Matcher m = p.matcher(input);
    while (m.find())
      System.out.println(m.group());
    }

  • Command line style regular expression string parser

    Hi people,
    I am currently working on a program where I need to parse a file (or any input stream) line by line. I then need to parse every line for arguments. Each line is formatted similar to how arguments are passed to the command line. The regular expression needs to split every line by any encountered whitespace, but needs to be able to retain any whitespace within double quotes (i.e. "some spaced text here"). Arguments can be numbers, booleans and (quoted) strings. Quoted strings must also be able to have escaped quotes in it (as below). The quotes for the quoted string (the outer ones, obviously not the escaped ones) do not necessarily have to be retained.
    An example input line:
    arg1 arg2 "arg 3" "arg 4" 987 arg6 "arg \"arg \"arg 7"
    Desired example output:
    arg1
    arg2
    arg 3
    arg 4
    987
    arg6
    arg "arg "arg 7
    After the input line has been split up the program will handle any parsing (i.e. numbers, booleans, etc.). The program currently uses a simple for loop to iterate over all characters in the line and splits it up appropriately by checking every character. However, if this can be done automatically by using a regular expression passed to String.split() (or with some use of the regex package), it would remove quite a bit of redunant code and make the program that much more maintainable.
    I do not have much experience with regular expressions since I have never really had the need to use them, but if they can work in this case it would be great.
    Thanks in advance for any help.

    Almost any parsing problem can be solved if you throw a big enough and ugly enough regex at it, or so I'm told.
    I think what you are doing is also amenable to java.io.StreamTokenizer:
    import java.io.*;
    import static java.io.StreamTokenizer.*;
    public class StreamTokenizerExample {
        public static void main(String[] args) throws IOException {
            StringReader input = new StringReader("arg1 arg2 \"arg 3\" \"arg 4\" 987 arg6 \"arg \\\"arg\\\" arg 7\"\nnextline");
            StreamTokenizer in = new StreamTokenizer(input);
            in.eolIsSignificant(true);
            for(int ttype; (ttype = in.nextToken()) != TT_EOF; ) {
                switch (ttype) {
                    case TT_WORD:
                        System.out.println("String[" + in.sval + "]");
                        break;
                    case TT_NUMBER:
                        System.out.println("number[" + in.nval + "]");
                        break;
                    case TT_EOL:
                        System.out.println("[EOL]");
                        break;
                    case '"':
                        System.out.println("quoted[" + in.sval + "]");
                        break;
                    default:
                        System.out.println("unexpected " + ttype);
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Converting String Characters into Regular Expression Automatically?

    Hi guys.... is there any program or sample coding which is available to convert string characters into regular expression automatically when the program is run?
    Example:
    String Character Input: fnffffffffffnnnnnnnnnffffffnnfnnnnnnnnnfnnfnfnfffnfnfnfnfnfnnnnd
    When the program runs, it automatically convert into this :
    Regular Expression Output: f*d

    hey guys.... i am sorry for not providing all the information that you guys need as i was rushing off to urgent meeting... for my string characters i only have a to n.. all these characters are collected from sensors and stored inside database... from many demos i have done... i found out that every demo has different strings of characters collected and these string of characters will not match with the regular expressions that i had created due to several unwanted inputs and stuff... i have a lot of different types of plan activities and therefore a lot of regular expressions.... if i put [a-z|0-9]*... it will capture all characters but in the same time it will be showing 1 plan only.... therefore, i am finding ways to get the strings i collected and let it form into regular expression by themselves in the program so that it will appear as different plans as output with comparing with the regular expression that i had created.... is there any way to do so?
    please post again if there is any questions u are still not familiar with... thank you...

  • How to create a list of string if a regular expression is given ?

    Hi folks,
    I have a regular expression say abcd[a-z]\\\.[0-9] . ( please ignore one '\')
    For this string i know that
    following string matches successfully
    1. abca.0
    2. abcb.1
    3. abcz.9 ......etc n number of combination are possible.
    is there any algorithm which will create some randomn strings from a regular expression.
    input to algorithm : some string pattern
    output to algorithm : some matching strings ( can be a single or an array of matching strings)
    Thanks in advance..
    Sethu
    Edited by: Sethumadhavan on Apr 16, 2008 6:32 AM

    Can u please give little more explanation...
    If i get some some values i can exit with the values ... and from the values i got i can ignore the duplicates ...
    But i am not getting the basic algorithm to get list of strings.....( DFA? or NFA?)
    thanks
    sethu

  • Get the string between li tags, with regular expression

    I have a unordered list, and I want to store all the strings between the li tags (<li>.?</li>)in an array:
    <ul>
    <li>This is String One</li>
    <li>This is String Two</li>
    <li>This is String Three</li>
    </ul>
    This is what have so far:
    <li>(.*?)</li>
    but it is not correct, I only want the string without the li tags.
    Thanks.

    No one?
    Anoyone here experienced with Regular Expression?

  • Need help with Regular Expressions

    This is my XML code
    *<name>J. E. O'Rrrrrr, S. Mmmmmmmmmm, B. G. Mmmmmmmm, A. B. C. Xxxxxx Yyyyy, A. B. C. Zzzz and C. R. McCcccc</name>*
    This is my source code
    Regex = Pattern.compile("<name>.*?</name>");
    RegexMatcher = Regex.matcher(fetchWholeFile);
    while(RegexMatcher.find())
    chkEnty = RegexMatcher.group();
    Pattern RegexTry1 = Pattern.compile("([A-Z]{1}\\.[A-Z]{1}\\.[A-Z]{1}\\.){color:#ff6600}|{color}([A-Z]{1}\\.\\s[A-Z]{1}\\.\\s[A-Z]{1}\\.){color:#ff6600}|{color}([A-Z]{1}\\.[A-Z]{1}\\.){color:#ff6600}|{color}([A-Z]{1}\\.\\s[A-Z]{1}\\.){color:#ff6600}|{color}([A-Z]{1}\\.)");
    //In the above line I am trying to catch all the initials (3 initals, 2 initials & 1 initial)
    Matcher RegexMatcherTry1 = RegexTry1.matcher(chkEnty);
    while(RegexMatcherTry1.find())
    String chkEntyTry1 = RegexMatcherTry1.group();
    Tagged11="<fname>"+chkEntyTry1+"</fname>";
    fetchWholeFile=fetchWholeFile.replace(chkEntyTry1,Tagged11);
    After executing the above code, my out is
    *<name><fname>J.</fname>* E. O'Rrrrrr, *<fname>S.</fname>* Mmmmmmmmmm, *<fname><fname><fname><fname>B.</fname></fname></fname></fname> <fname>G.</fname>* Mmmmmmmm, *<fname>A.</fname>* *<fname><fname><fname><fname>B.</fname></fname></fname></fname>* *<fname>C.</fname>* Xxxxxx Yyyyy, *<fname>A.</fname>* *<fname><fname><fname><fname>B.</fname></fname></fname></fname>* *<fname>C.</fname>* Zzzz and *<fname>C.</fname>* *<fname><fname>R.</fname></fname>* McCcccc*</name>*
    But I need my out as below
    *<name><fname>J. E. </fname><sname>O'Rrrrrr</sname>,* *<fname>S. </fname><sname>Mmmmmmmmmm</sname>*, *<fname>B. G. </fname><sname>Mmmmmmmm</sname>*, *<fname>A. B. C. </fname><sname>Xxxxxx Yyyyy</sname>*, *<fname>A. B. C. </fname><sname>Zzzz </sname>and <fname>C. R. </fname><sname>McCcccc</sname></name>*
    Could some also tell me how do I apply *<sname>*

    prometheuzz my source code as suggested by you is
    public void lineread(String FileName)
         try
              File asciiFile1 = new File(FileName);
              File tmp = new File(asciiFile1.getParent(),"Temp.xml");
              BufferedReader br = new BufferedReader(new FileReader(asciiFile1));
              BufferedWriter bw = new BufferedWriter(new FileWriter(tmp));
              String line = "";
              while((line = br.readLine()) != null)
                   fetchWholeFile+=line;
              Pattern Regex = Pattern.compile("<ref.list>.*?</ref.list>");
              Matcher RegexMatcher = Regex.matcher(fetchWholeFile);
              while(RegexMatcher.find())
                   chkEnty = RegexMatcher.group();
              Regex = Pattern.compile("<name>.*?</name>");
              RegexMatcher = Regex.matcher(chkEnty);
              while(RegexMatcher.find())
                   chkEnty = RegexMatcher.group();
                   Matcher m1 = Pattern.compile("([A-Z]\\.\\s?)+").matcher(chkEnty);
                   while(m1.find())
                        String Fname1=(m1.group());
                        String Fname2=("<fname>"+m1.group()+"</fname>");
                        FnameVector1.addElement(Fname1);
                        FnameVector2.addElement(Fname2);
                   Matcher m2 = Pattern.compile("([A-Z]['a-z]+\\s?)+").matcher(chkEnty);
                   while(m2.find())
                        String Sname1=(m2.group());
                        String Sname2=("<sname>"+m2.group()+"</sname>");
                        SnameVector1.addElement(Sname1);
                        SnameVector2.addElement(Sname2);
              for(int v=0;v<FnameVector1.size();v++)
         System.out.println(FnameVector1.elementAt(v));//It's printing fine here      
              for(int v=0;v<FnameVector2.size();v++)
                   System.out.println(FnameVector2.elementAt(v));//It's printing fine here
                   fetchWholeFile=fetchWholeFile.replace(FnameVector1.elementAt(v).toString(), FnameVector2.elementAt(v).toString());//But if I update to input XML file, it's wrong as shown below
              for(int v=0;v<SnameVector1.size();v++)
         System.out.println(SnameVector1.elementAt(v));//It's printing fine here
              for(int v=0;v<SnameVector2.size();v++)
                   System.out.println(SnameVector2.elementAt(v));//It's printing fine here
                   fetchWholeFile=fetchWholeFile.replace(SnameVector1.elementAt(v).toString(), SnameVector2.elementAt(v).toString());//But if I update to input XML file, it's wrong as shown below
              bw.write(fetchWholeFile);
              bw.flush();
              bw.close();
              br.close();
              File org = new File(FileName);
              System.gc();
              System.out.println(asciiFile1.delete());
              tmp.renameTo(org);
         catch(IOException ioe)
              System.out.println(ioe);
    This is my XML file
    <?xml version="1.0" encoding="UTF-8"?>
    <ref-list>
    <name>A. B. Cccccc and X. Y. Zzzzzz</name>
    <name>K. Name</name>
    The output after executing the above source code is
    <?xml version="1.0" encoding="UTF-8"?>
    <ref-list>
    <name><fname>A. </fname>B. <sname>Cccccc</sname>and <fname>X. <fname>Y. </fname></fname><sname>Zzzzzz</sname></name>
    <name><fname><fname><fname><fname><fname><fname>K. </fname></fname></fname></fname></fname></fname><sname>Name</sname></name>
    But I need my output as
    <?xml version="1.0" encoding="UTF-8"?>
    <ref-list>
    <name><fname>A. B. </fname><sname>Cccccc</sname>and <fname>X. Y. </fname><sname>Zzzzzz</sname></name>
    <name><fname>K. </fname><sname>Name</sname></name>
    Please tell me where have I gone wrong.

  • String validation without regular expressions

    Hello all
    I'm facing a little problem, basically i have to make a method that validates an input String "a name"
    Numbers and symbols are not allowed, but white spaces are.
    The method has to be implemented without the use of JFormattedTextField or regular expressions.
    What i'm doing right now is this:
    public boolean validate(String name){
       char[] arr=name.toCharArray();
        for(Char c:arr){
          if(!Character.isLetter(c)){
           return false;
      return true;
    }That isLetter() method is very useful but it sees the white spaces are "non letters".
    I am a bit lost at this point, i'm trying a lot of methods of String and Character but nothing seems to work
    do you have any advice?
    Thx

    enrico wrote:
    That isLetter() method is very useful but it sees the white spaces are "non letters".
    I am a bit lost at this point, i'm trying a lot of methods of String and Character but nothing seems to work
    do you have any advice?Yes: don't try to do it all in one expression. 'If' statements allow you to use '&&' and '||' to connect expressions, so use them.
    Second: Work out what you want to do BEFORE you start programming.
    In this case, you need to know exactly which characters you want to allow, +and when+ (see baftos' examples above).
    Third:for(Char c:arr){is meaningless (unless you've defined a class called 'Char').
    Accuracy is important.
    Winston

  • Need help starting with regular expressions

    Hi,
    looked through the tutorials, and some stuff online and still having trouble.
    I've done a fair amount of modifying xml files with perl, and want to do the same thing with java.
    I'm writing this at work, and we don't have the 1.5 jdk installed, so I can't use the Pattern and Match objects.
    Here's some code I wrote:
    package pack1;
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    public class PlantTest {
          * @param args
          * @throws Exception
         public static void main(String[] args) throws Exception {
              // get file to read from
              java.io.File infile = new java.io.File("plant.xml");
              FileReader infileReader = new FileReader(infile);
              BufferedReader bInfile = new BufferedReader(infileReader);
              //get basic file info
              System.out.println("does the file exist? " + infile.exists());
              System.out.println("file is located at: " + infile.getAbsolutePath());
              System.out.println("file was last modified: " + new java.util.Date(infile.lastModified()));
              // create a pattern
              String match = "<COMMON>";
              String line = bInfile.readLine();
              while (line != null){
                   //System.out.println(bInfile.readLine());
                   if (line.matches(match)){
                        System.out.println("match made: " + line);
              bInfile.close();
              infileReader.close();
    }I want the "match" object to be the equivalent of this in perl:
    (I realize I don't have the output set up in the code above, I was going to add it later, for now I just want to make the match and print something on the console)
         m/<COMMON>([^<]+)</COMMON>/i;
         $common = $1;
         print HTML "<p>Common Name: $common\n";here's a snippet of xml:
         <PLANT>
              <COMMON>Bloodroot</COMMON>
              <BOTANICAL>Sanguinaria canadensis</BOTANICAL>
              <ZONE>4</ZONE>
              <LIGHT>Mostly Shady</LIGHT>
              <PRICE>$2.44</PRICE>
              <AVAILABILITY>031599</AVAILABILITY>
         </PLANT>(I cribbed that xml from the w3c site)
    thanks in advance,
    bp
    Message was edited by:
    badperson

    ouch. 1.3.1...
    That's here at work, I'm kind of nervous about
    downloading another jdk, will there be a conflict?Google for Jakarta ORO regex. It is about the same speed as Java regex and works well with JDK1.3.1 .

  • How to split a string with regular expression

    Hi.
    I need to split a string with a regular expression.
    Example
    String = "this is; a test";rune haavik;12345;
    And I want the output to be:
    "this is; a test"
    rune haavik
    12345
    If I use this code:
    private void test1()
    String str = "\"this is; a test\";rune haavik;12345;";
    int i=0;
    String[] tmp = str.split(";");
    while(i<tmp.length)
    System.out.println(tmp);
    i++;
    Then it splits also in the "" text.
    Regards
    Rune haavik

    Rune haavik:
    The most effective way to achieve the end result is, I believe, to read the characters one by one, using a flag that indicates if we are inside quotation or not.
    Well, if we are in a mind game, then the following should do.
           String[] tmp = str.split(";(?![^\"]*\";)");

  • 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","");

  • Going on line with airport express.

    My G5 is connected thru an airport express and is slow to come on-line (beachball)
    or send a message. Is this normal?

    Welcome to the Apple Discussions!
    No this is not normal. However, to help you we need to know how you have configured both the AirPort Express and the Mac.
    BTW, you do not have a G5. Apple stopped making the G5s in the first part of 2006. You have an Intel-based iMac, either an Intel i5 or i7.
    Dah•veed

  • Help with regular expression needed

    Hi,
    Perhaps someone here can help me with my regular expression I'm trying to build in my Java code.
    The regular expression that I'm looking to build consists of any non-whitespace character up until it finds one or two <>= symbols and then any character thereafter. So both these Strings would match the expression:
    City 1==London
    Age>=18
    The regular expression that I'm using is as follows:
    (\\S+)([><=]){1,2}(.+)However, group 1 always retrieves the first <>= symbol as in "City 1=". How can I make the <>= part greedy so that it retrieves both operator symbols?
    Thanks.

    Make the first group, the non-spaces, reluctant:
    "(\\S+?)([<>=]{1,2})(.+)"

  • String extract using regular expression

    Hi
    I have text like this "<a>45</a><ct>Hi</ct><R>45 85</R><H>Here</H>" .I want to extract using regular expression or any techniques the text between <R> and </R> also need to replace the space with pipe between 45 and 85 like "45|85"
    Edited by: vishnu prakash on Mar 2, 2012 4:42 AM

    Hi,
    Here's one way:
    REPLACE ( REGEXP_REPLACE ( txt
                    , '.*<R>(.*)</R>.*'
                    , '\1'
         , '|'
         )This assumes there is only one <R> tag in txt.
    Always say which version of Oracle you're using. The expression above will work in Oralce 10 and up, but starting in Oracle 11 you can use REGEXP_SUBSTR rather than the less intuitive REGEXP_REPLACE.
    Edited by: Frank Kulash on Mar 2, 2012 7:48 AM

Maybe you are looking for

  • Add multiple objects to a Deque to be retrieved in that order?

    All: We are using a LinkedBlockingDeque in a classic producer/consumer setup -- multiple threads may post "commands" to the Q, and the consumer retrieves and executes each command in a separate thread. We have very rare cases where we need to post mo

  • Text elements translation to other language

    Hi Friends, I have added new text elements in english language to show some text in the output of the program. The program showing the expected output. But if the user login with non english language like FR or DE ... stll the output is showing in En

  • What DVD External Drive do I need

    Hello I want to upgrade my vs. 10.2.28 to 10.4 but I only have a CD drive. Can someone send me a link for a brand/model or tell me exactly what type of external DVD firmware drive I need to get so that I can install 10.4 on my system. Thank you!

  • BAPI to get purchasing price maintained in MEK3

    Hello Gurus, Which BAPI allowes to get price condition created in MEK3 transaction (purchasing price)? Many thanks, Stéphane

  • RMAN Qn

    While opening database with resetlogs option got error ORA - 01152 : File 1 was not restored from sufficiently old backup ORA - 01110 : Data file 1: 'usr3/ oracle/.../system01.dbf' Looks like I need to recover database from old backups. How do I inst