Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Regex Parsing Chars in a Line

by rsFalse (Hermit)
on Nov 24, 2019 at 21:23 UTC ( #11109160=note: print w/replies, xml ) Need Help??

in reply to Regex Parsing Chars in a Line

So what is your question? What do you want to achieve and what is your data? Can you elaborate more? You say about parentheses in one place, then about hyphens in another.

I'll try to rewrite last of your regex in more readable form with '/x' modifier:
$name =~ s/ (\() # $1 (.+) # $2 (?!\)) /$1$2\)/gx;

Replies are listed 'Best First'.
Re^2: Regex Parsing Chars in a Line
by kel (Acolyte) on Nov 26, 2019 at 04:58 UTC
    The parenthesis repacement with the lookahead works. I thought that the solution to the hyphen issue should work with lookahead/behinds, but it didnt. I apoolgize for the confusion, but that example was only to show that the basic mechanism worked on Perl v26 in Win. Oddly, some operators seem to be recalcitrant on Win, as opposed to Linux. Even with stripping permissions/ownership of target files. I am looking for a clean method for parsing hyphens, and my current method often requires a second run.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11109160]
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: (3)
As of 2020-01-24 02:42 GMT
Find Nodes?
    Voting Booth?