Regular expression needed to escape dots

Hello
In a file , I might have several times a line like this :
VALOR DESCUENTO .......                           1,505,728.80What is the regular expression to get *1,505,728.80* ? Please note that there are dots ..how do i escape them ?
This is what I use , but it does not work
String descuentoPattern = "VALOR DESCUENTO(?:\\s+?)(?:^\\s+?)(?:\\s+?)(.*)"; cheers,
deibys

BigDaddyLoveHandles wrote:
The same way you escape any character -- with a backslash.Remembering to double-up backslashes in Java strings, of course.
@deibys, your regex is wrong. Try this instead:
String foo = "VALOR DESCUENTO .......                           1,505,728.80";
String pattern = "VALOR DESCUENTO\\s*\\.+\\s+(.*)";
Pattern p = Pattern.compile(pattern);
Matcher m = p.matcher(foo);
if (m.matches()) {
     System.out.println("Match found: " + m.group(1));
}

Similar Messages

  • Java Regular Expression Need Help

    I want regular Expression that accept all numbers and it should skip the numbers if it comes in {}

    No this is not workingThen you need to be MUCH clearer as to exactly what you are trying to acheive...
    We aren't mind readers... try posting the string you are parsing and the exact result that you want to get

  • Regular expression substitution with escaped $

    I'm looking to perform a substitution (along the lines of String.replaceAll()) that matches with the character $. I have tried $, \$, \\$, and variations thereof in the regex string utilizing String.replaceAll() and with a Pattern.compile(). In both cases I get an "Illegal repetition near index X" error. Anyone have suggestions as to escaping the $ character for regular expression substitutions?
    Edited by: dolcraith57 on Dec 6, 2007 11:18 AM

    It would help if you'd post details--e.g. original string and desired result, with an explanation of the rules.
    str1 = "a$1$2$b$";
    str2 = str1.replaceAll("\\$", "X"); // aX1X2XbX
    str3 = str1.replaceAll("\\d", "\\$"); // a$$$$$b$

  • 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})(.+)"

  • Regular Expression needed for a password validator

    Business Rules:
    Password must be at least 8 characters
    Contain at least 1 non alpha character and no spaces.
    Here is what I got so far:
      String regex = "(?=^.{8,}$)((?!.*\\s)(?=.*[^a-zA-Z])(?=.*[a-zA-Z0-9]))^.*$";
            String [] password = new String [7];
            password [0] = "H@ffman1";
            password [1] = "hoffman1";
            password [2] = "Hoffman1";
            password [3] = "Hoffman 1";
            password [4] = "hoffman 1";
            password [5] = "hoffmans";
            password [6] = "123456789";
            for(int i=0; i<password.length; i++){
                Pattern pattern = Pattern.compile(regex.trim());
                Matcher matcher = pattern.matcher(password);
    System.out.println(password[i] + " == " + matcher.matches());
    }Output:
    H@ffman1 == true
    hoffman1 == true
    Hoffman1 == true
    Hoffman 1 == false
    hoffman 1 == false
    hoffmans == true // (This is a problem)
    123456789 == true // (This is a problem)

    YoungWinston wrote:
    prometheuzz wrote:
    which is pretty much what our OldWinston suggested...Actually, I was thinking more along the lines of
    System.out.println( password.matches("^[^\\s]{8,}$")
    && password[i].matches("[^a-zA-Z]") );
    (I may have got the number of backslahes wrong; 'always forget that stuff).Ah, I see. But you probably meant:
    password.matches(".*[^a-zA-Z].*")and they're cryptic enough as it is :-).
    Cryptic? Nah...

  • SUBSTR or regular expression needed

    Hello,
    I have the below example:
    CREATE TABLE "ARCHITECT"."TEST_DD"
    (     "TABLE_NAME" VARCHAR2(100),
         "APPLICATION_NAME" VARCHAR2(100),
         "COLUMN_NAME" VARCHAR2(100),
         "COLUMN_DESCRIPTION" VARCHAR2(2000)
    ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "MYTABLESPACE"
    i want to have the below result
    CREATE TABLE "ARCHITECT"."TEST_DD"
    (     "TABLE_NAME" VARCHAR2(100),
         "APPLICATION_NAME" VARCHAR2(100),
         "COLUMN_NAME" VARCHAR2(100),
         "COLUMN_DESCRIPTION" VARCHAR2(2000)
    That is mean i want to cut every think after PCTFREE, the above create table is just and example, i may have any create table statement with the PCTFREE keyword
    Please can i have your help

    modify the transform parameters
    SQL> begin
      2     dbms_metadata.set_transform_param(dbms_metadata.session_transform,'STORAGE',false);
      3     dbms_metadata.set_transform_param(dbms_metadata.session_transform,'TABLESPACE',false);
      4     dbms_metadata.set_transform_param(dbms_metadata.session_transform,'SEGMENT_ATTRIBUTES', false);
      5  end;
      6  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> select dbms_metadata.get_ddl ('TABLE', 'EMP')
      2    from dual
      3 
    SQL> /
    DBMS_METADATA.GET_DDL('TABLE','EMP')
      CREATE TABLE "SCOTT"."EMP"
       (    "EMPNO" NUMBER(4,0) NOT NULL ENABLE,
            "ENAME" VARCHAR2(10),
            "JOB" VARCHAR2(9),
            "MGR" NUMBER(4,0),
            "HIREDATE" DATE,
            "SAL" NUMBER(7,2),
            "COMM" NUMBER(7,2),
            "DEPTNO" NUMBER(2,0)
    SQL>

  • Regular expressions: serious design flaw?

    I wondered why sometimes, the replaceAll() method works in my code and sometimes it throws a java.util.regex.PatternSyntaxException. I wrote a little test case to show the problem
    private void regularExpressionTest() {
            String escapers = "\\([{^$|)?*+."; //characters to escape to avoid PatternSyntaxException
            String text = "The quick brown fox jumps over the lazy dog.";
            System.out.println("Original: "+text);
            String regExp = "o";
            String word = "HELLO";
            String result = text.replaceAll(regExp, word);
            System.out.println("Replace all '"+regExp+"' with "+word+": "+result);
            text = "The quick brown {animal} jumps over the lazy dog.";
            System.out.println("Original: "+text);
            regExp = "{animal}";
    //        regExp = escapeChars(regExp, escapers); //escape possible regular expression characters
            word = "catterpillar";
            result = text.replaceAll(regExp, word);
            System.out.println("Replace all '"+regExp+"' with "+word+": "+result);
    }//regularExpressionTest()The output is:
    Original: The quick brown fox jumps over the lazy dog.
    Replace all 'o' with HELLO: The quick brHELLOwn fHELLOx jumps HELLOver the lazy dHELLOg.
    Original: The quick brown {animal} jumps over the lazy dog.
    java.util.regex.PatternSyntaxException: Illegal repetition
    {animal}
         at java.util.regex.Pattern.error(Pattern.java:1528)
         at java.util.regex.Pattern.closure(Pattern.java:2545)
         at java.util.regex.Pattern.sequence(Pattern.java:1656)
         at java.util.regex.Pattern.expr(Pattern.java:1545)
         at java.util.regex.Pattern.compile(Pattern.java:1279)
         at java.util.regex.Pattern.<init>(Pattern.java:1035)
         at java.util.regex.Pattern.compile(Pattern.java:779)
         at java.lang.String.replaceAll(String.java:1663)
         at de.icomps.prototypes.Test.regularExpressionTest(Test.java:57)
         at de.icomps.prototypes.Test.main(Test.java:34)
    Exception in thread "main" As the first replacement works as espected, the second throws an Exception. Possible because '{' is a special character for the regular expression API. In case I know the regular expression, i could escape these special characters. But in my generic server app, the strings are all parameters, so the only way for replaceAll() to work is, to escape all possible special characters in the regular expression.
    1. Is there a complete list of all special characters for regular expressions that need to be escaped?
    2. Is there a similar replaceAll() method without regular expressions? So that all occurences of a substring can be replaced by another string? (So far, I wrote my own method but this is of course more time consuming for massive string operations.)

    1. The complete list of specially-recognized characters are listed in the Java 1.4.* API. (Of course, new ones may eventually be added as the regex package matures).
    2. It is time consuming to program in general. You should have written your own utility method that goes through a String using indexOf and building up the String in a StringBuffer, and apparently you did. Now you have the utility method...you no longer need to write that method again.
    3. Or you could have written some kind of method that automatically escapes the specially-recognized characters...

  • 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}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Validate Email by regular Expression... Need Help

    Dear All,
    Requirement:
    validate the email ID entered & throw error message, if it is invalid.
    DATA c_mailpattern TYPE c LENGTH 60 VALUE
    '[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4} '.
    ** If @ is present, more than once. Error out
        find ALL OCCURRENCES OF '@' in P_email
        MATCH COUNT v_count.
        if v_count > 1.
          v_badpattern = 1.
        endif.
    ** If , is present, once, Error out
        find ALL OCCURRENCES OF ',' in P_Email
        MATCH COUNT v_count.
        if v_count > 0.
          v_badpattern = v_badpattern + 1.
        endif.
        FIND REGEX c_mailpattern IN P_Email IGNORING CASE .
        IF sy-subrc <> 0 OR v_badpattern > 0.
    Write:/ p_EMAIL, 'has invalid Email format'.
    ENDIF.
    though this works fine, tester needs me to catch, if domain name has "app.com.com"  as invalid email id.
    above regex fails in such case.
    I searched & found
    {messageID=3706355}
    messageID=1657369}{
    https://wiki.sdn.sap.com/wiki/display/Snippets/E-MAIL+Validation
    doesn't help.
    I found this regex in a perl program.
    [a-z0-9!#$%&'{size:14}*+{size:14}/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
    Can I get help to modify this  into ABAP String?
    1) I can't bypass the boldened text using Escape characters like #* or '' Can some one help me assign this regex-string into a string variable?
    2) This regex is longer than allowed length for a literal.
    It can be split into 2 strings, then concatenated & checked.
    Edited by: Mallikarjuna J on May 16, 2011 8:23 PM
    Edited by: Mallikarjuna J on May 16, 2011 8:26 PM

    Thanks Sebastian, Pratik & Keshav for the replies.
    SX_INTERNET_ADDRESS_TO_NORMAL doesn't validate a wrong email ID. It only splits the internet address into mail & domain.
    Prathik,
    just .com.com is not the point, Bad input could be .net.ent or .net.com or so....
    Amol, Thanks, but I keep receiving Error, not found in the 41 line response I get
    I think we need to check not line 2 but line 28.
    Taking cue from Prathik, I'm planning to put this
    *** ls_inputmail-mail is the email-id entered by user.
    ************ Check for Valid Regular Expression
    *****   DOT(.) is allowed more than once,
    *****   @ is allowed only once,
    *****   , is not allowed.
    ** If @ is present, more than once. Error out
        find ALL OCCURRENCES OF '@' in ls_input_mail-mail
        MATCH COUNT v_count.
        if v_count > 1.
          v_badpattern = 1.
        endif.
    ** If , is present, once, Error out
        find ALL OCCURRENCES OF ',' in ls_input_mail-mail
        MATCH COUNT v_count.
        if v_count > 0.
          v_badpattern = v_badpattern + 1.
        endif.
    **   Find if domain part i.e., after @ has errors.
        SPLIT ls_input_mail-mail at '@' into v_mailpart v_domain.
    *    there's a dot in the domain.
        if v_domain Co '.' .
    *     last 2 char can only be country name, not anything else.
          SPLIT v_domain at '@' into v_domain1 v_domain2.
    *      v_domain2 can only be a country name, else error out
      select single landx from t005 into v_country
        where landx = v_domain2.
        if sy-subrc <> 0.
          v_badpattern = v_badpattern + 1.
        endif. 
        ENDIF. 
        FIND REGEX c_mailpattern IN ls_input_mail-mail IGNORING CASE .
        IF sy-subrc <> 0 OR v_badpattern > 0.
    Write:/ ls_inputmail-mail, 'has invalid email format'.
      ENDIF.
    However, I was wondering, if there was a way to  use escapae characters & make the beow string as a valid regex variable to check email id.
    [a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
    Nevertheless, Thanks Friends for all your inputs.
    Edited by: Mallikarjuna J on May 17, 2011 2:23 PM

  • Regular Expression escaping problem!

    Hi all,
    Well as you know characters such as '*' and '?' are reserved characters in regular expression so I suppose if I want to find the exact character (a '?' for example) in a string, I have to escape it with a backslash:
    str=str.replaceAll("\?","a");
    In the statement above, I need to replace all question marks with another character but it has a compile error:
    Error(116,48): invalid escape character
    to my surprise this following code does the job while it should be interpreted as: one occurance of the '\' character or nothing at all:
    str=str.replaceAll("\\?","a");
    What's the problem? what's the general rule on escaping such characters?

    I think you're right.
    The point is that java first interprets the String and handle its own scape characters then the result would be passed on to reqular expression parser.
    so I guess in order to search for one occurance of the '\' character or nothing at all the java string would be:
    so that the input to reqular expression parser would be:
    while in the first situation:
    a "\\?" java string is first trasformed into \? which will be considerd as one occurance '?' in reqular expression point of view...
    Message was edited by:
    nerssi
    Message was edited by:
    nerssi

  • Need help in unix regular expressions

    Hi All,
    I'm new to shell scripting. Please help me in achieving this
    I am trying to a find regular expression that need to pick a file with begin with the below format and mask variable is called in xml file.
    currently the script accepts:
    mask="CLIENT_ID+'_ADHSUITE_IN_'+date2str(now,'MMddyy','US/Eastern')+'.txt'"
    But it should accept in the below format
    2595_ADHSUITE_IN_ANNWEL_030309_2009-02-10_15-12-46-000_648.TXT715.outpgp_out
    where CLIENT_ID=2595. How to place wild card character '*' in the below to accept file in the above format. here is what i made changes.
    mask="CLIENT_ID+'_ADHSUITE_IN_'*+date2str(now,'MMddyy','US/Eastern')*+'.TXT'*+'.outpgp_out'"
    Please help.
    Thanks

    I believe your statement is being passed over twice:
    First Pass: (This is done by something like javascript)
    CLIENT_ID+'_ADHSUITE_IN_'+'.*'+date2str(now,'MMddyy','US/Eastern')+'.*'+'.TXT'+'.*'+'.outpgp_out'In this pass the variables and functions that are enclosed in literals are processed:
    (1) CLIENT_ID is replaced by 2595 or whatever is current value is:
    (2) date2str(now,'MMddyy','US/Eastern') gets replaced by 040609 (if the current time now is 4th april 2009).
    So at the end of this first pass we have a string:
    2595_ADHSUITE_IN_.\*040609.\*.TXT.*.outpgp_outThis string at the end of the first pass is a Posix basic regular expression. (ref: [http://en.wikipedia.org/wiki/Regular_expression] ) accessed at time of post).
    This is the string I put in the Regular Expression text box on [http://www.fileformat.info/tool/regex.htm]
    and it matches "2595_ADHSUITE_IN_ANNWEL_040609_2009-01-27_17-02-28-000_631.TXT715.outpgp_out" for me (though I prefer my egrep test).
    I hope this is somewhat clearer. Remember I have very little information about your system/application and I make big guesses.
    NB: (I should thank Frits earlier for pointing my sloppiness between wildcards (for eg unix shell filename expansion) and regular expressions).
    For the second pass this used to compared other strings to see

  • I need help renaming a file using regular expressions in Bridge.

    Hi,
    I work at a university, and we are working through files for our Thesis and Dissertations. We have been renaming them to make them more consistent. I am just wondering if there is a regular expression that could help with this process?
    Here is come examples of current file names;
    THESIS 1981 H343G
    Thesis 1981 g996e
    THESIS-1981-A543G
    I don't need to change the actual names of the files. just how they are formatted.
    Proper case on Thesis.
    Hyphens(-) in all white space.
    First letter capital, last letter lowercase on the call no (H343g)
    So the list above should look like;
    Thesis-1981-H343g
    Thesis-1981-G996e
    Thesis-1981-A543g
    I have seen people do some pretty cool things with regular expressions! Any help would be greatly appreciated. Thanks!

    You would be better off using a script to do this as an example as I don't think it would be possible in the Bridge re-name.
    Using ExtendScript Toolkit or a Plain text editor copy the code into either and save it out as Filename.jsx
    This needs to be saved into the correct folder. this is found by going to the preferences in Bridge, selecting Startup Scripts, this will open the folder where the script is to be saved.
    Once this is done close and re-start Bridge.
    To Use: Goto the Tools Menu and select Rename PDFs
    Make sure you test the code with a few copied files into a seperate folder first to make sure it does what you want.
    The script will do all PDF files in the selected folder.
    #target bridge 
    if( BridgeTalk.appName == "bridge" ) { 
    renamePDFs = MenuElement.create("command", "Rename PDFs", "at the end of Tools");
    renamePDFs.onSelect = function () {
    app.document.deselectAll();
    var thumbs = app.document.getSelection("pdf");
    for( var z in thumbs){
    var Name = decodeURI(thumbs[z].spec.name);
    var parts = Name.toLowerCase().replace(/\s/g,'-').match(/(.*)(-)(.*)(-)(.*)(\.pdf)/);
    var NewName = parts[1].replace(/^[a-z]/, function(s){ return s.toUpperCase() });
    NewName += parts[2]+parts[3]+parts[4]+parts[5].toUpperCase().replace(/[A-Z]$/, function(s){ return s.toLowerCase() });
    NewName += parts[6];
    thumbs[z].spec.rename(NewName);

  • Help needed regarding regular expressions

    hello
    i need to write a program that recieves a matematical expression and evaluates
    it...in other words a calculator :)
    i know i need to use regular expressions inorder to determine if the input is legal or not ,but i'm really having trouble setting the pattern
    the expression can be in the form : Axxze2223+log(5)+(2*3)*(5+4)
    where Axxze2223 is a variable(i.e a combination of letters and numbers.)
    where as: l o g (5) or log() or Axxx33aaaa or () are illegal
    i tried to set the pattern but i got exceptions or it just didnt work the way i wanted it .
    here's what i tried to do at least for the varibale form:
    "\\s*(*([a-zA-Z]+\\d)+)*\\s*";
    i'm really new to this...and i can't seem to set the pattern by using regular expressions,how can i combine all the rules to one string?
    any help or references would be appreciated
    thanks

    so i'll explain
    let's say i got token "abc22c"(let's call it "token")
    i wan't to check if it's legal
    i define:
    String varPattern = "\\s*[a-zA-Z]+\\d+\\s*";If you want to check a sequence of ASCII characters, longer than one, followed by a single digit, the whole possibly surrounded by spaces -- yes.
    >
    now i want to check if it's o.k
    so i check:
    token.matches(varPattern);
    am i correct?Quite. It's better to compile the Pattern (Pattern.compile(String)), create a java.util.regex.Matcher (Pattern#matcher(CharSequence)), and test the Matcher for Matcher#matches().
    (Class.method -> static method, Class#method -> instance method)
    >
    now i'm having problem defining pattern for log()
    sin() cos()
    that brackets are mandatory ,and there must be an
    expression inside
    how do i do that?First, I'd check the overall function syntax (a valid name, brackets), then whether what's inside the brackets is a valid expression (maybe empty), then whether that expression is valid for that function (presumably always?).
    I might add I'm no expert on parsing, so that's more a supposition than a guide.

  • Need help in writing regular expressions involving \w

    Hi,
    Here is my requirement .
    I have a string : GTA - 12AB TRA - 12AB
    I need a regex that represent above string.
    GTA - Constant - This wont change
    12AB - This will be \w (alphanumeric)
    Here I cannot have TRA within this 4 characters.
    The question is :
    How can I write an expression which says it can be a word(the positions where I have 12AB in example) but not TRA in sequence.
    Is this doable?
    Thanks in advance.

    Use lookarounds: [http://www.regular-expressions.info/lookaround.html]
    The regex:
    (?!.?TRA).{4}matches any 4 characters (except line breaks) that does not contain 'TRA'.

  • [DW CC] Regular Expression and Back Reference in "Replace with": Escape

    I have a problem with escaping a character in "Replace with".
    Let's assume the following situation:
    Content:
    foobar
    Search for:
    (foo)(bar)
    Replace by:
    $1zot$2
    Result:
    foozotbar
    Everything is fine.
    But I want to insert the number "2" in between foo and bar.
    When I use
    Replace by: $12$2
    The result is:
    $12$2
    It seems that the regex engine interpretes the "$12" as a whole. And because there's no back reference with the count "12" DW cannot work correctly.
    The question:
    How can I "escape" the "2"?
    Thanks.

    Dreamweaver uses JavaScript for its Find and Replace with regex.
    I've just checked the Regular Expressions Cookbook by Jan Goyvaerts and Steven Levithan (O'Reilly). It deals with exactly this sort of situation where capturing groups can be ambiguous. This is what it says:
    "Java and JavaScript try to be clever with $10 [and above]. If a capturing group with the two-digit number exists in your regular expresssion, both digits are used for the capturing group. If fewer capturing groups exist, only the first digit is used to reference the group, leaving the second as a literal. Thus $23 is the 23rd capturing group, if it exists. Otherwise, it is the second capturing group followed by a literal 3."
    In other words, there is no way to escape the 2 in the Replace field. It would appear there's a bug in Dreamweaver's use of capturing groups.

Maybe you are looking for