Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Re^3: Regex, extracting stuff from the middle of a line

by ikegami (Patriarch)
on Aug 03, 2006 at 19:29 UTC ( #565536=note: print w/replies, xml ) Need Help??


in reply to Re^3: Regex, extracting stuff from the middle of a line
in thread Using a regex function from a hash

Your requirements are very vague.

  • You didn't specify which components are constant and which are not. I assumed "\" and "date : " are constant.
  • You didn't specify of which chars the variable parts could be made. I assumed what is represented by "GeorgeO" could contain spaces (which required specifying " at the parker inn"),
  • You didn't specufy from where the lines came. I assumed a file handle.
  • You didn't specify what to do with the extracted values. I print them.
while (<$fh>) { print("$1\n") if /\\(.*?) at the parker inn$/ or /^date : (\S+)/; }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2022-10-01 14:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (126 votes). Check out past polls.

    Notices?