[Implemented] RegExp

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

[Implemented] RegExp

Post by blueznl »

see here... viewtopic.php?p=70899#70899

regular expressions to use on strings would be nice...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Yes.
@}--`--,-- A rose by any other name ..
PolyVector
Enthusiast
Enthusiast
Posts: 499
Joined: Wed Sep 17, 2003 9:17 pm
Location: Southern California
Contact:

Post by PolyVector »

could somebody please explain to me what RegExp is? :?:
I've heard some talk about it lately and to be honest I'm feelin' a bit out of the loop :oops:
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

know a little dos?

it's like using wildcards, patterns and the like, only more flexible aka. more complex :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
PolyVector
Enthusiast
Enthusiast
Posts: 499
Joined: Wed Sep 17, 2003 9:17 pm
Location: Southern California
Contact:

Post by PolyVector »

Ohhh... got it :)
I coded one of those for Rapid-Q a while back... I wonder if I still have it! :)
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

PolyVector wrote:could somebody please explain to me what RegExp is? :?: I've heard some talk about it lately and to be honest I'm feelin' a bit out of the loop :oops:
http://etext.lib.virginia.edu/helpsheets/regex.html :)
Regular Expresions are extremely useful for checking and/or replacing strings. Very quick too.
--Kale

Image
ivory
User
User
Posts: 36
Joined: Fri Jun 25, 2004 2:30 am

Post by ivory »

Kale wrote:
PolyVector wrote:could somebody please explain to me what RegExp is? :?: I've heard some talk about it lately and to be honest I'm feelin' a bit out of the loop :oops:
http://etext.lib.virginia.edu/helpsheets/regex.html :)
Regular Expresions are extremely useful for checking and/or replacing strings. Very quick too.
I don't know if I would call them very quick. They are adequate for working with small strings and parameter lists, but I have found them quite unsatisfactory working with large strings.

Another similar product I have used is "AWK", but still, nothing beats a well written piece of code.
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

I guess i meant very quick to input complicated search patterns. i.e. checking an email address is easy :)
--Kale

Image
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Post by techjunkie »

Yeahh!!!

:D

regexp would be so cool!!!

/<(\w+)[^>]*>[^<]*<\/\1>/ig

:lol:
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
prefuct
New User
New User
Posts: 3
Joined: Fri Aug 20, 2004 2:41 pm

Post by prefuct »

*loses his lunch*
naw
Enthusiast
Enthusiast
Posts: 573
Joined: Fri Apr 25, 2003 4:57 pm

Post by naw »

Regular Expressions are a must for a X-Platform Language (that includes Unix/Linux). Its true that ReExprs are fairly painful to learn - but believe me if you come from the Unix/Linux Scripting world and take RegExpr for granted with SED / AWK / GREP etc. Its a hard painful world without them. Seriously, 10 chars of RegExpr = 100 lines of code in any regular language.

Ok - perhaps a slight exaggeration, but those who use it know what I mean.

Such a shame that PB lacks RE & STDIN :-(

Please Fred STDIN would take you a couple of hours to code :-) and you could bolt in a *standard* RE Library, I'm sure....
Ta - N
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

stdin / stdout yes please...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
hattonpa
New User
New User
Posts: 7
Joined: Tue Feb 24, 2004 10:13 pm
Location: Tampa Bay

Post by hattonpa »

Yes, regular expressions please! Also, STDIN/STDOUT please!

The PBRegExpEx lib by FloHimself is a great help. But I had to work for a while to get my head around the syntax and build my own procedures to make its implementation a little easier for me. It reminds me somewhat of PCRE, which I used once in a C++ app. I'm sure part of the reason for the time it took was because I'm new to PureBasic. No global or case-insensitive functionality. But, I'm certainly glad FloHimself has provided it. I'm a regular expression junkie :)
Paul H.
bluejoke
User
User
Posts: 11
Joined: Thu Nov 11, 2004 4:30 pm
Location: Guenzburg, Bavaria, Germany
Contact:

Post by bluejoke »

I would appreciate a RegExp-implication, too!
hattonpa
New User
New User
Posts: 7
Joined: Tue Feb 24, 2004 10:13 pm
Location: Tampa Bay

Post by hattonpa »

Just wanted to correct my previous statement that with PBRegExpEx there is 'no... case-insensitive functionality'. There is, in fact, control over case sensitivity when searching with the meta characters \u (upper case) and \l (lower case). Guess I hadn't read the Help file carefully enough. <grimace> So, while I prefer Perl's syntax of "/[a-z]+/i" I can get the results I need using PBRegExpEx with "(/u|/l)+". Of course, in this case, I'd have the possible overhead of an unneeded backreference or subexpression.

Anyway, just thought I'd clarify, in case anyone cares...

Paul H.
Post Reply