- The first Regular Expression Library on the Web!

Please support RegExLib Sponsors


Regular Expression Details

Title Test Find Pattern Title
Can anyone help me with this problem? I want X to give me the correct index of >. For example if this is my code: var MsgString="<button onclick='4>5?a():b();'>";>/ig); X will give me 18 instead of 30. How can I get it to ignore > that are within quotes? Please help. I would really appreciate it if anybody could give me some advice. Thanks so much. -Logan
<test a>
Author Rating: Not yet rated. Logan Tran
Your Rating
Bad Good

Enter New Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Try this
Name: Lars Echterhoff
Date: 8/13/2005 12:21:21 PM
<(.*?\W)> OK, its not as clean as it can be but a possible solution. This matches everything inside your tag and finishes matching with an > after anything else than charcters oder numbers (just boundaries). Just try.

Title: Possible solution...
Name: Alex Forencich
Date: 8/12/2005 6:00:27 PM
Can't you just use lastIndexOf()?

Title: Coder
Name: Chad
Date: 2/3/2004 7:11:08 AM
Unfortunately what you want to do is a 'negative' match which regex doesnt really do well except for very simple featureless negative matching. Your best bet is to use a character by character parser which walks through the string switching on a flag when is comes across a quote and then ignores '>' until it finds the closing quote.

Copyright © 2001-2018, | ASP.NET Tutorials