Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: How to substitute something from only between two specified charecters (sub_question)

by wind (Priest)
on Jun 29, 2011 at 19:37 UTC ( #912020=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to substitute something from only between two specified charecters (sub_question)
in thread How to substitute something from only between two specified charecters

I wrote the regex that way to have an explicit boundary between the second field and the spacing separating it from the third field. I didn't want to eat any extra spacing.

I could have accomplished this in one of three ways:

  1. 1) Explicitly specify that the field shouldn't contain a space at the end like I did. (.*\S)\s+
  2. 2) Use an explicit boundary like (.*)\b\s+
  3. 3) Or rely on non-greedy matching: (.*?)\s+ Which would work because of the hard boundaries for the other fields

In the end, the third method above would probably appear the cleanest, but they all accomplish the same thing in the context of the rest of the regex.

  • Comment on Re^3: How to substitute something from only between two specified charecters (sub_question)
  • Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://912020]
help
Chatterbox?
[Eily]: Just another Perl coeurs
[Eily]: (perl with hearts, 'Acker with a French accent is pronunced like coeurs)
[LanX]: IMHO 'ju' for 'u' happens in English where they can't pronounce the French u (or German )
[LanX]: and I'm sure I read that *hotel* used to be pronounced 'otel by the English upperclass
[Your Mother]: American English vowels are pretty lazy/mumbly in general.
[LanX]: talking about antisemitism, youtube automatic subtitles is entertaining shocking sometimes ... like when offering "Fruit Jews" as a drink
[Your Mother]: ...Come on you King of the Juice...
[Your Mother]: I actually know his kids.
LanX has to go/

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2017-03-27 17:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.