Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: RegEx - Positive Look-ahead

by 7stud (Deacon)
on Feb 05, 2013 at 18:42 UTC ( #1017247=note: print w/ replies, xml ) Need Help??


in reply to RegEx - Positive Look-ahead

This regex:

/[aaaaa]/

is equivalent to:

/[a]/

So this regex:

[^{{}}]

Is equivalent to:

[^{}]

I am expecting it to match the entire block up to the first mismatched '}}'

Huh?

First, you said this:

I am using the following to extract data with a {{Infobox ... }} block, with the catch being that there might be {{ ... }} blocks within it.

Then you said this:

The problem is that this does not match if I have {{ something {{{ text }}} }} in my content ...

Here is a regex that will 'match' both:

/.*/

To ask a regex question that is specific enough to get a relevant answer, you need to post:

  1. An example of your text.
  2. The exact text you want to end up with.

Note that for 2), you DO NOT post a description of the text that you want to end up with. Why? Because descriptions are usually gibberish, and at best they are subject to different interpretations. If required, repeat steps 1) and 2) as many times as needed to highlight the twists and turns in the text you need to match.


Comment on Re: RegEx - Positive Look-ahead
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1017247]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (17)
As of 2014-10-30 14:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (208 votes), past polls