Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Little help with simple regex pattern.

Status
Not open for further replies.

travisbrown

Technical User
Dec 31, 2001
1,016
Learning as I go....

What's the regex pattern to find all instances of something like this: test1224269150994="271"

<td test1224269150994="271">
<tr test1224269150994="271" test1224269150994="281">

I'm trying test.*> but it selects the last > in the document, not the next instance after the start of the pattern.

I'm just trying to replace them with empty strings.

Thanks
 
I thnk this is it: test.+?"[0-9]+"

Look right?
 
If test prefix is not generic, do this for name/value pair.
[tt] rx=/\w+\s*=\s*("|').*?\1/g;[/tt]
If test prefix is something you want to restrict the name structure, this to do the restriction.
[tt] rx=/test\w*\s*=\s*("|').*?\1/g;[/tt]
If test prefix and that it is following by numbers as the subset of name structure, then this.
[tt] rx=/test\d+\s*=\s*("|').*?\1/g;[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top