Page 1 of 1

Counter of intrement

Posted: Wed Jun 23, 2010 4:58 am
by Casey Basichis
Hi,

Is there any way to add an incrementing counter in a regex command?

I read that if the search contains a *[0-9], a %0> will add an incrementing number, but I haven't been able to get it to work.

The search text is id=""

The regular expression is : id="*[0-9]"

The replace text is : id="%>"

Any help would be greatly appreciated

Posted: Wed Jun 23, 2010 5:02 am
by Casey Basichis
Sorry that was increment

Note, I was trying the replace text with both %> and %0> neither worked.

i also cant get id="" to recognize with id="*[0-9]"

I placed a temporary id="1" for testing which does recognize but the replacement looks like

id="%>"

Posted: Wed Jun 23, 2010 9:50 pm
by Fool4UAnyway
Try id="[0-9]*" instead of id="*[0-9]".

The asterisk * goes for the match before it, so your original regex searches for any string of consecutive double quote marks, or none at all and requires one and only one digit to follow.

You may use \d for [0-9]. It is shorter and easier.

\d+ = any string of digits requiring at least one = a number
\d* = any string of digits or none at all = nothing or a number

Posted: Fri Jun 25, 2010 1:16 pm
by zdv
Replace Counters "%0>" aren't part of .NET (TextCrawler) regular expressions. I think the example you gave relates to a custom command from another piece of software.