[closed] RegExp: finding only the first match

Post your bug reports here.
Post Reply
kellyholmes
Posts: 5
Joined: Tue May 24, 2005 4:29 pm

[closed] RegExp: finding only the first match

Post by kellyholmes »

I don't think this is a bug, but I didn't want to put this under Suggestions!

I have a text string like this that I'm searching:

Code: Select all

<!-- begin parent: UM 3800Evihiersubvi --><p class="Body">You can create a subVI from an Express VI configuration. For example, you might want to save the configuration of the Write to File Express VI for use as a subVI in other VIs you build rather than reconfiguring the Express VI every time. Right-click the Express VI and select <strong>Open Front Panel</strong> from the shortcut menu to create a subVI from an Express VI.</p><!-- end parent: UM 3800Evihiersubvi -->
I'm trying to write a RegExp to ignore the part in HTML comment tags when doing a compare. I tried <!--\w+--> but what was ignored was all the text in the paragraph above until the last -->

Is there any way to specify in a RegExp that you want to find the first match, then stop? I also tried this one: <!--[^>]+--> In other words, search for <!-- then 1 or more of any character besides >, then -->, but this still finds and ignores the entire paragraph in the example above.

thanks in advance for any help!
Kelly

grigsoft
Site Admin
Posts: 1673
Joined: Tue Sep 23, 2003 7:37 pm
Contact:

Post by grigsoft »

In my experience <!--[^>]+--> works just fine. The only problem is comments could extend to multiple lines, while RegExp in Compare It! does not work over line end (yet). So good choice could be using "Ignore lines between R1 and R2" rule, with R1 = <!--, R2 = -->

Post Reply