Jump to content

Matching between comment lines


WorldDrknss

Recommended Posts

First you need to learn that < ! - > are not special characters. Escaping them with backslashes makes you look a bit silly.

Then learn about the /x and /s flags. One of them is what you need. The other is me trying to trick you into learning something unrelated.

Then test your regular expression with some HTML content that contains two or more of those FOR/END FORs and see what happens.

Link to comment
Share on other sites

  • 3 months later...

Also, you need to look into how to make your capturing conditions "greedy" or "non greedy". By default, matches will be greedy. So a condition such as "A(.*)B" with the string "A1B A2B A3B" would find one match "1B A2B A3" - everything form the first "A" to the last "B". If you wanted to find all the values between each set of A/B, then you need make the match non-greedy - "A(.*?)B"

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.