Re: Regex question
- From: axel@xxxxxxxxxxxxxxxxxxxxxx
- Date: Mon, 18 Apr 2005 20:50:44 -0500
Gunnar Hjalmarsson <noreply@xxxxxxxxx> wrote:
> axel@xxxxxxxxxxxxxxxxxxxxxx wrote:
>> John wrote:
>>> Match a quoted string unless it is preceded by '--', the '--' can only
>>> be preceded by whitespace.
>>>
>>> e.g for a target string of :
>>>
>>> DISPLAY-HINT "1x:"
>>>
>>> "1x:" should be matched
>>>
>>> for a target string of :
>>>
>>> -- DISPLAY-HINT "1x:"
>>>
>>> nothing should be matched.
>>
>> Do I understand this correctly... when you say "1x" should be matched,
>> do you want to capture this value? If then the following will ignore
>> white-space at the start of the string, not match '--' at the start of
>> the string:
>>
>> /^\s*[^ -]{2}.*"(.*)"/
>
> What about 'P-HINT "1x:"' or 'A HINT "1x:"'? ;-)
It wouldn't works :(
So, maybe;
/^ (?! \s*--) .* "(.*)" /x
Axel
.
- References:
- Regex question
- From: John
- Re: Regex question
- From: axel
- Re: Regex question
- From: Gunnar Hjalmarsson
- Regex question
- Prev by Date: How to export constants to a module?
- Next by Date: Re: my $hh = %hash
- Previous by thread: Re: Regex question
- Next by thread: Yet another regex question.
- Index(es):
Relevant Pages
|