try
/^(.+)a706(.+)$/
starts with one or more of any character followed by literally 'a706'
or
preg_match('/^(.+)a706\/(.+)\/(.+)$/',"$test_string");
starts with one or more of any character followed by literally 'a706' and then /, more chars, /,more chars at the end of the string
returns boolean true if $test_string contains 'a706' in the specified position
also
$1 == 'model-abc-';
$2 == 'software version 0.3';
$3 == 'sumptin else';
will return true
That's all I got, there's more ways to skin that cat for sure.
Guy Ross
On Wednesday, June 10, 2009 9:16 PM, Chris Jones wrote:
>
>Date: Wed, 10 Jun 2009 21:16:39 -0500
>From: Chris Jones
>To: nolug@nolug.org
>cc:
>Subject: Re: [Nolug] test
>
>Generally, regex's are more picky than that. A isn't going to match
>a, plus all those characters before and after the regex have to be
>matched wtih a wildcard. It really depends on what you're trying to
>do that determines the right approach.
>
>On Wed, Jun 10, 2009 at 7:06 PM, Petri Laihonen<pietu@weblizards.net> wrote:
>> Tried to send again, but for some reason this post does not appear in the
>> nolug list.
>> Therefore, since my reply to "test" appeared, perhaps this one does too.
>>
>>
>> Orig Subject: Regex help needed
>>
>> Do we have any regex geniuses on the wire?
>>
>> I've heard regular expressions are powerful thing....... I agree ....they
>> are very powerful driving you nuts trying to figure them out.....
>>
>> I'm trying to match 2 strings together.... (Will use in a PHP environment)
>> String 1: "ABC%A706" (Where % is a wildcard, thus should match to any
>> character)
>> String 2: "
a706/ software version 0.3 /sumptin else"
>> String 3: "model-abc-h706/ software version 0.3 /sumptin else"
>>
>>
>> With the above strings, 1 and 2 would be match, but 1 and 3 are not.
>>
>> In other words, anything before, on the % sign, and after the string 1
>> is OK. As long as portions "abc" and "a706" are found from the longer
>> string with only one character, ....any character in between them.
>>
>> Any hints?
>>
>> Petri
>>
>>
>>
>> Joey Kelly wrote:
>>>
>>>
>>
>> --
>> This message has been scanned for viruses and
>> dangerous content by MailScanner, and is
>> believed to be clean.
>>
>> ___________________
>> Nolug mailing list
>> nolug@nolug.org
>>
>
>
>
>--
>Chris Jones
>http://www.doomsdaytechnologies.com
>___________________
>Nolug mailing list
>nolug@nolug.org
___________________
Nolug mailing list
nolug@nolug.org
Received on 06/10/09
This archive was generated by hypermail 2.2.0 : 08/06/09 EDT