Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^5: Regex with condition

by AnomalousMonk (Bishop)
on Nov 20, 2015 at 17:03 UTC ( #1148246=note: print w/replies, xml ) Need Help??

in reply to Re^4: Regex with condition
in thread Regex with condition

... many thanks for your great help

It may or may not have been so great, but you are very welcome in any case.

... you are obviously the most helpful Monk in this forum ...

Many thanks for the compliment, but if you are around this place for long, you will find others who are much more patient and helpful (not to mention authoritative!) than I. In general, the effort the gentle Monks will expend to help you is in direct proportion to the effort you are willing to expend to help yourself.

... I had difficulties in understanding the real meaning of $pre and also the $post ... this new form of writing a regex is new for me ...

I like this approach to composing regexes. The rationale for factoring regexes in this way is the same as for factoring functions into subsidiary functions: they become easier to think about, maintain, etc. And, of course, the free use of whitespace allowed by the  /x switch greatly aids readability.

In my OP I have abreviated my data ... I have just overlooked the space betweeen FEN and the " ... in my real data there is leading whitespace before the 'Weiss' line, but in the testfile I have deleted it ...

I'm sorry if a note of annoyance crept into my responses anent the changing data examples in your posts. These data are instances of "specification by example", and changing a specification, however implicit, after work has been done is always irritating. The design of regexes, parsers, etc., for data handling is very sensitive to the detailed structure of the data. The Devil is in the details, and sometimes the Devil uses these details to tempt us to the deadly sin of Wrath!

Give a man a fish:  <%-{-{-{-<

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2019-08-19 23:14 GMT
Find Nodes?
    Voting Booth?
    If you were the first to set foot on the Moon, what would be your epigram?

    Results (141 votes). Check out past polls.