Page 1 of 1

Find text chunk with tags, tabs, line endings- use wildcard?

Posted: Wed Oct 15, 2008 12:52 pm
by kiblinger
I am working in a VBScript / JavaScript ECMA-262 regular expression environment:

I have something like:

Code: Select all

           <attr>
                <attrlabl>SUBBASIN</attrlabl>
            </attr>
 
or:

Code: Select all

           <attr>
                <attrlabl>SUBBASIN</attrlabl>
                <attrdef>XYZPDQ</attrdef><attrdefs>ABCDEFG</attrdefs></attr>

and I want to do this:

FIND:

Code: Select all

<attr>  ---ANYTHING---  <attrlabl>SUBBASIN</attrlabl>  ---ANYTHING---  </attr>
REPLACE WITH:

Code: Select all

<attr> <attrlabl>SUBBASIN</attrlabl>   <newtag>Other Stuff</newtag> <anothertag>More stuff</anothertag>   </attr>
 
I thought

Code: Select all

<attr>*<attrlabl>SUBBASIN</attrlabl>*</attr>
would work but it doesn't. I am stumped; \s seems to maybe be involved to account for various \t \r and \n characters but I still can't get a wildcard to capture all the other stuff.

Re: Find text chunk with tags, tabs, line endings- use wildcard?

Posted: Wed Oct 15, 2008 1:06 pm
by prometheuzz
This doesn't seem to be PHP related and cross posted here:

http://regexadvice.com/forums/thread/47237.aspx