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

Re: What is regular expression for the following thing?

by Punitha (Priest)
on Oct 20, 2008 at 09:13 UTC ( #718171=note: print w/replies, xml ) Need Help??

in reply to What is regular expression for the following thing?

Hi sanjay nayak

You can have a quick reference about the perl regular expressions here

Moreover in your example coding you misused the matching operator. It should be =~ and you may want something like this

if ($text =~ /^(?:REGISTER|INVITE|BYE)\s\w+[-@_]\w+\.\w+\sSIP\/2\.0/) { print "IN:$text\n"; }


Replies are listed 'Best First'.
Re^2: What is regular expression for the following thing?
by ikegami (Pope) on Oct 20, 2008 at 09:18 UTC
    I think you meant [-\@_].
    >perl -le"@_='abc'; print qr/[-@_]/;" (?-xism:[-abc])

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://718171]
[Corion]: Meh. I have a very simple mechanism to scrape+track prices, and even to send me mail if something changes (via cron), but SQLite doesn't support window functions, so my simple SQL to determine a price change won't work :-( Maybe I should store the DB ...
[Corion]: ... in Pg, but that would mean that I'd have to deal with credentials and stuff :)
[Corion]: In fact, the whole thing is just four simple programs, one App::scrape, another being DBIx::RunSQL, and one some glue to convert a JSON object into an SQL INSERT statement (+DBI connect/execute), so it would be an incredibly simple solution...
[Corion]: ... but that simplicity falls down due to SQLite letting me down and me being too lazy to move to a real DB. Maybe DBD::CSV can handle window functions...
[hippo]: Pg has the "trust" mechanism if you don't fancy using credentials for a trivial db.

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2018-02-23 15:05 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (302 votes). Check out past polls.