How's this?

/(((<|>)=?)|==)(-?\d+)/

Then the comparison operator is in result[1] and the number is in
result[4].  You said "integer", so I threw in the optional negative sign. :)

Dave

On Thu, Mar 5, 2009 at 10:02 AM, Glen Pike <[email protected]>wrote:

> Hi,
>
>   How about:
>
>   /([=><]+)([0-9]+)/
>
>   Check out "RegExr" by Grant Skinner - it's lovely.
>
>   The problem with <= and >= is that there is "look behind" in the regex
> controlled by these chars so the order of =>< seems to be important???
>     Glen
>
>
> Jiri wrote:
>
>> I would like some help on a regExp
>>
>> I have a string and want to split it into the first character being a
>> <|>|<=|>=|== the second part being an int.
>>
>> so ">100"
>>
>> would return
>> result[1] = '>'
>> result[2] = 100
>>
>> so "100"
>>
>> would return
>> result[1] = 'undefined'
>> result[2] = 100
>>
>> Here is what I have so far, but it is killing me.
>>
>>    var pattern:RegExp = /^(\d)?(^\d+)|(<?????>)/
>>    var result:Object = pattern.exec(tConditionalString);
>>
>> I tried another approach but i am still figuring out how to do it. It goes
>> something like this
>>    var pattern:RegExp = /^(>):((?(2)then|else))
>>
>>
>> Jiri
>>
>>
>>
>>
>> _______________________________________________
>> Flashcoders mailing list
>> [email protected]
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>>
>>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to