Go Back   FlashFXP Forums > >

Programming Need help with C/C++/Delphi? Ask here and make us all laugh.

Closed Thread
 
Thread Tools Rate Thread Display Modes
Old 09-28-2003, 06:25 PM   #1
vod
Member
FlashFXP Registered User
ioFTPD Registered User
 
Join Date: Jun 2002
Posts: 84
Default regular expressions

Can anyone point me to a sane and simple regular expression lib i can use in vc++ 7.x

I just wanta be able to do like
.*something.*somethingelse.*boo{.*}.*etc

where the one in brackets is the group/expression i wanta extract, most ive seen id have to know that the 4th match was the one i wanted...i just wanta pass a string and have a value pulled out without knowing which num match it will be...if that makes sence..heh
vod is offline  
Old 09-28-2003, 06:29 PM   #2
Mouton
Posse Member
Ultimate Scripter
ioFTPD Administrator
 
Join Date: Dec 2002
Posts: 1,956
Default

I doubt there's a sane and simple regexp lib for vc++...
I use re_lib. not easy to play with, but working great.

btw, it's () not {} to fetch values.

not sure i understand what ur trying to do though...
in fact, i'm sure i don't!
Mouton is offline  
Old 09-28-2003, 09:30 PM   #3
vod
Member
FlashFXP Registered User
ioFTPD Registered User
 
Join Date: Jun 2002
Posts: 84
Default

Quote:
Originally posted by Mouton
I doubt there's a sane and simple regexp lib for vc++...
I use re_lib. not easy to play with, but working great.

btw, it's () not {} to fetch values.

not sure i understand what ur trying to do though...
in fact, i'm sure i don't!
i finally got greta to compile (that unimportant file i didnt link was important afterall), but i cant get it to do what i want, i can get it to extract the whole match but not part of it...
in perl compat yea () is grouping set,, i know of some that use {} for sets though

anyway, say i have
This random >> hello kitty << boo bob random random
i wanta extract first word in >><<
so i do like ">>.* .*<<" but my match will be ">> hello kitty <<" and not just "hello", id have to explicatly say i want use the first one (like perl it would be $1 i think), i sware there is some way to say "match this but dont count it"
im not sure that makes any more sence than what i posted before, heh

oh well, **** the regular expressions anyway, ill do it staticly
vod is offline  
Old 09-29-2003, 08:07 AM   #4
Mouton
Posse Member
Ultimate Scripter
ioFTPD Administrator
 
Join Date: Dec 2002
Posts: 1,956
Default

text: >> hello kitty << boo bob random random

regexp: >> ([^ ]*) .* << .*

\1 will give u the first word after >> all the time, since the match is only what's between ().
Mouton is offline  
Old 09-29-2003, 09:45 AM   #5
FTPServerTools
Senior Member
FlashFXP Beta Tester
ioFTPD Scripter
 
Join Date: Sep 2002
Posts: 543
Default

Download regex.c or regex.cpp from the web. I find it overdone tho, you can use simple regex from the unzip.c source codes.
FTPServerTools is offline  
Old 09-29-2003, 08:45 PM   #6
vod
Member
FlashFXP Registered User
ioFTPD Registered User
 
Join Date: Jun 2002
Posts: 84
Default

Quote:
Originally posted by FTPServerTools
Download regex.c or regex.cpp from the web. I find it overdone tho, you can use simple regex from the unzip.c source codes.
ah, its all good, i dont think what i want is posiable, but its ok cause the way i did it is faster anyway. i imported the greta regex lib, its slightly big but pretty damn fast.
vod is offline  
Closed Thread

Tags
match, pass, regular, string, wanta

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 04:47 AM.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)