Re: RegEx challenge - doesn't work
From: A. Sinan Unur (1usa_at_llenroc.ude.invalid)
Date: 11/16/04
- Next message: l v: "Re: RegEx challenge - doesn't work"
- Previous message: Sam: "Re: regexp question"
- In reply to: John R: "Re: RegEx challenge - doesn't work"
- Next in thread: l v: "Re: RegEx challenge - doesn't work"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 16 Nov 2004 20:28:28 GMT
google@servangle.net (John R) wrote in
news:100a40e5.0411161204.3a13a9a9@posting.google.com:
> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
> news:<Xns95A2D6215D1Casu1cornelledu@132.236.56.8>...
>> while(<DATA>) {
>> if( /^dsr:(".+"); height:(\d+); width:(\d+); client:(".+")\s*$/ )
>> {
>> push @data, {
>> dsr => $1,
>> height => $2,
>> width => $3,
>> client => $4,
>> };
>> }
>> }
>
> Thanks for the effort, but this will not work either. Your regex is
> pattern matching the specific words "dsr" "height" etc... Maybe I
> should have mentioned this earlier, the name/value pairs cannot be
> predicted. The expected format is:
> name:value; name:value; name:"value blah"; name:"valu;e"
The quality of the help you get is in direct proportion to the amount of
effort you put into formulating your question. Your question contained an
incomplete description of the problem.
Please see http://www.catb.org/~esr/faqs/smart-questions.html
>> Yeah whatever ... An almost identical question was posted and
>> answered withing the last couple of days. Doesn't anyone lurk and
>> read the FAQ any more?
>
> Give me some more credit here. I read the FAQ. This is a unique
> situation.
Your situation is not unique. You have not read the FAQ.
>
>> What do you mean "resulting in two arrays"?
>
> RegEx option /m like /(\w+):?([^;]+)?;\s?/m for multiple matches
> you'll get an array foreach grouping () eachtime the pattern is
> repeatedly matched.
Each time you capture matches, the match in list context returns a list
of matches. There are no arrays involved. Again, it is time to hit the
FAQ list.
> Does anyone understand my question?
Oh yes. And your question has been answered completely by the FAQ
reference I posted.
Sinan
- Next message: l v: "Re: RegEx challenge - doesn't work"
- Previous message: Sam: "Re: regexp question"
- In reply to: John R: "Re: RegEx challenge - doesn't work"
- Next in thread: l v: "Re: RegEx challenge - doesn't work"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|