Re: [Nolug] test

From: Petri Laihonen <pietu_at_weblizards.net>
Date: Wed, 10 Jun 2009 22:34:59 -0500
Message-ID: <4A307B63.1020704@weblizards.net>

I don't think so.
However, the entity I receive these values is using % as a wildcard.
I would convert it into a real value, but I don't know what the real
value there is. Also, the % would not work for the real-life matching
since I know that value does not exist in the real strings I need to
match against.

Petri

Ron Johnson wrote:
>
>
> Are you sure that % is a regex wildcard?
>
> On 2009-06-10 21:56, Petri Laihonen wrote:
>> yep... I'm looking this to be case insensitive.
>> And have wildcards at the end and at the beginning. and this one "%"
>> spot in between.
>>
>> Therefore in my example below "ABC" and "A706" are "known" values,
>> though case insensitive.
>> Also the length of the "known" values vary.
>> Flow:
>> I have these values such as this "ABC%A706", in a database (value 1).
>> Then I have another set of values like this "model-abc-a706/ software
>> version 0.3 /sumptin else" detected by PHP script (value 2).
>>
>> Most likely I would normalize both values to lowercase first.
>>
>> With value 1, I have some other properties in the database as well,
>> one of them is an ID.
>>
>> I'm trying to run a foreach loop which attempts to find value 1 from
>> value 2.
>>
>> If the match is found, then I break the loop, and read the associated
>> ID.
>>
>>
>> If these 2 values would be reversed, the process would be very
>> simple, and no need for additional woodoo, but unfortunately this is
>> not the case.
>>
>>
>> Petri
>>
>>
>> Chris Jones wrote:
>>> 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: "model-abc-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?
>>>>
>

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
___________________
Nolug mailing list
nolug@nolug.org
Received on 06/10/09

This archive was generated by hypermail 2.2.0 : 08/06/09 EDT