[Gambas-user] Re gular Expression Help

hinchy eoinhinchy at ...626...
Tue May 27 17:22:35 CEST 2008


Yeah I thought about doing something like that, the thing is though, I won't
always know how long the first word is. With the regex I can match until the
first white space. Is there a way of doing that with text splitting? If so
great. If not is there anywhere you could suggest I look for example regex
implementation in gambas?

Thanks again.



M0E Lnx wrote:
> 
> why not just do some text splitting to get what you need?
> 
> If you have "sda1" and you only want "sda" out of that... you should
> be able to go with Newstring=left(sStr, 3)
> 
> 
> 
> On 5/27/08, hinchy <eoinhinchy at ...626...> wrote:
>>
>>  keywords: regex, Regular Expression, regexp, pcre
>>
>>  Hi guys,
>>
>>  I've been struggling with the pcre component for a couple of days now.
>> I'm
>>  running the command:
>>  SHELL "ls /dev | grep [sh]d[a-z]" TO sStr
>>
>>  This will return something along the lines of:
>>  sda
>>  sda1
>>  sda2
>>
>>  I then want to run the regular expression ^[^\s]*+ against sStr to
>> return
>>  sda for saving in a different string but I can't for the life of my
>> figure
>>  it out.
>>  Any ideas? I'm sure it's quite simple I just can't get it together.
>>  Thanks,
>>  Eoin
>>  --
>>  View this message in context:
>> http://www.nabble.com/Regular-Expression-Help-tp17488070p17488070.html
>>  Sent from the gambas-user mailing list archive at Nabble.com.
>>
>>
>> 
>> -------------------------------------------------------------------------
>>  This SF.net email is sponsored by: Microsoft
>>  Defy all challenges. Microsoft(R) Visual Studio 2008.
>>  http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>  _______________________________________________
>>  Gambas-user mailing list
>>  Gambas-user at lists.sourceforge.net
>>  https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 
> 

-- 
View this message in context: http://www.nabble.com/Regular-Expression-Help-tp17488070p17492934.html
Sent from the gambas-user mailing list archive at Nabble.com.





More information about the User mailing list