It is currently Fri Jun 22, 2018 2:19 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: REval v1.05x
PostPosted: Sun Sep 12, 2010 9:34 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat May 17, 2003 11:31 am
Posts: 6039
Simple tool to verify regular expressions.

Screenshot, code and executable can be found here:

http://www.xs4all.nl/~bluez/purebasic/p ... tm#4_reval

Direct download:

http://www.xs4all.nl/~bluez/purebasic/reval.zip

Perhaps it might be a good idea to add a little 'quick reference' sheet to the purebasic docs? Something like this: (I've hidden it in the 'help' function of REval.)

Code:
Quick Reference.
----------------

This text does not claim to be the complete (or correct) list of regular
expression components. It only provides a quick and dirty overview of
some of all the (sometimes esoteric :-)) options.


Characters:

  a              - single character 'a'
  \t             - tab, chr(9)
  \r             - return, cr, chr(13)
  \n             - line feed, lf, chr(10)
  \e             - escape, esc, chr(27)
  \x09           - specific character in hexadecimal, \x09 is for example tab
  \u20AC         - unicade character, \u20AC is the euro currency sign

Special characters:

  \d             - digit ie. single character 0 to 9
  \w             - word character ie. single character a-z, A-Z, 0-9, underscore
  \s             - single 'whitespace' character ie. space, tab, line breaks
  .              - any single character

Classes:

  a class is a group of characters enclosed by square brackets, each character
  inside the brackets is a valid match, ranges can be specified by using '-'

  [a]            - single character 'a'
  [ab]           - single character, either 'a' or 'b'
  [^a]           - inside brackets! any single character except 'a'
  [0-9]          - single character 0 to 9
  [0-9A-F]       - single hexadecimal character
  c[ao]t         - matches 'cat' and 'cot' but not 'cit' or 'ct'

  inside classes you do not have to escape any metacharacters except ^ \ ] -

Metacharacters:

  [ \ ^ $ . | ? * + ( )

  several characters have a special meaning, you need to 'escape' them (preceed
  them with a backslash) if you want to use them literally

  cats|dogs      - matches 'cats' or 'dogs'
  cats\|dogs     - matches 'cats|dogs'
  colo?r         - matches 'color' and 'colour'
  colo\?r        - matches 'colo?r'

  inside square brackets (classes) the dash '-' needs escaping as well

  [1\-2]         - matches '1' '2' and '-'
  [1-2]          - matches '1' '2' but not '-'

Repetition / wildcards:

  .              - any single character except line breaks (see multiline flag)
  ?              - preceding condition zero or one time
  *              - zero up to many times
  +              - one up to many times
  {n}            - n times
  {n1,n2}        - minimal n1 times, maximal n2 times
  a?             - nothing or 'a'
  test{3}        - matches 'testtt'
  [0-9]{3}       - matches '000' '001' etc. all the way up to '999'
  (test){3}      - matches 'testtesttest'
  get(value)?    - matches 'get' as well as 'getvalue'

  remember that the wildcards * and + are 'greedy'

Grouping:

  ()             - groups a part of the expression
  (test){3}      - matches 'testtesttest'

Position:

  ^              - outside brackets! start of the string
  $              - end of string
  bob            - bob may exist anywhere in the string
  ^bob           - string must start with 'bob'
  bob$           - string must end with 'bob'
  ^bob$          - string must be 'bob'
  \b             - word boundary
  \bis           - would match 'this is' but would not match 'thisis'
  \B             - opposite of \b, ie. the match must be 'inside' a word
  \Bis           - would match 'thatis' but would not match 'that is'
  \A \Z \z       - start and end of strings, see the web for more details

Alternatives:
 
  |              - seperate multiple options by pipe characters
  dog|cat        - match any string that contains dogs or cats
  (dog)|(cat)    - for readability some may prefer to group alternatives

Exotics not covered:

  backreferences, greedy vs. lazy vs. possessive, lookaround, modifiers, and more
  (these can become a sure cause for a definite headache) for example:

  ([0-9])\1{2}   - will match '11' '22' etc. but not '10'
  (?i)appel      - will match 'appel' as well as 'APPEL'

_________________
( PB5.xx Win10 x64 Asrock AB350 Pro4 Ryzen 1600X Evo 840 GTX1060 )
( The path to enlightenment and the PureBasic Survival Guide right here... )


Last edited by blueznl on Sun Feb 05, 2012 5:24 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: REval v1.04x
PostPosted: Wed Sep 15, 2010 9:01 am 
Offline
Addict
Addict
User avatar

Joined: Thu Feb 09, 2006 11:27 pm
Posts: 2272
Hi Blueznl,
no source code inside? :shock:


Top
 Profile  
Reply with quote  
 Post subject: Re: REval v1.04x
PostPosted: Wed Sep 15, 2010 3:19 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat May 17, 2003 11:31 am
Posts: 6039
Did I mess up my script? Oooops! :oops:

Let me check... Duh! Yeah, I forgot. I will change the script and upload the latest version tonight.

_________________
( PB5.xx Win10 x64 Asrock AB350 Pro4 Ryzen 1600X Evo 840 GTX1060 )
( The path to enlightenment and the PureBasic Survival Guide right here... )


Top
 Profile  
Reply with quote  
 Post subject: Re: REval v1.04x
PostPosted: Thu Sep 16, 2010 11:34 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat May 17, 2003 11:31 am
Posts: 6039
Uploaded the file again. It now includes the source code.

Note that I did not include the include files I always use, g_spot.pb and x_lib.pb. If you want to build the executable or run/test the source you can download those two together with CodeCaddy or SweetSpot. You can probably easily remove any references to those two files anyway.

_________________
( PB5.xx Win10 x64 Asrock AB350 Pro4 Ryzen 1600X Evo 840 GTX1060 )
( The path to enlightenment and the PureBasic Survival Guide right here... )


Top
 Profile  
Reply with quote  
 Post subject: Re: REval v1.04x
PostPosted: Sun Feb 05, 2012 5:23 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat May 17, 2003 11:31 am
Posts: 6039
Updated to v1.05x.

Cleaned up the code a little, changed layout a bit, and added a box at the bottom for 'extracted' data.

_________________
( PB5.xx Win10 x64 Asrock AB350 Pro4 Ryzen 1600X Evo 840 GTX1060 )
( The path to enlightenment and the PureBasic Survival Guide right here... )


Top
 Profile  
Reply with quote  
 Post subject: Re: REval v1.05x
PostPosted: Thu Feb 09, 2012 11:48 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Feb 16, 2006 1:41 am
Posts: 179
Location: New Zealand
Thanks blueznl, nicely done (as always), thanks for sharing the source as well.

(Useful links under the "Help" menu item, as well)

_________________
Win8.1, PB5.x, okayish CPU, onboard video card, fuzzy monitor (or is that my eyesight?)
"When the facts change, I change my mind" - John Maynard Keynes


Top
 Profile  
Reply with quote  
 Post subject: Re: REval v1.05x
PostPosted: Tue Jul 30, 2013 11:18 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat May 17, 2003 11:31 am
Posts: 6039
Minor update. Can't recall what it was, probably just a newer version of x_lib and a little larger font. I'm getting older myself, the eyes do not always cooperate :-)

_________________
( PB5.xx Win10 x64 Asrock AB350 Pro4 Ryzen 1600X Evo 840 GTX1060 )
( The path to enlightenment and the PureBasic Survival Guide right here... )


Top
 Profile  
Reply with quote  
 Post subject: Re: REval v1.05x
PostPosted: Mon Mar 07, 2016 4:57 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Feb 09, 2006 11:27 pm
Posts: 2272
Hi Blueznl,
maybe someone has downloaded your program, it seems so, that is has gone... :shock:


Top
 Profile  
Reply with quote  
 Post subject: Re: REval v1.05x
PostPosted: Tue Mar 08, 2016 9:33 am 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 4136
Location: Lyon - France
Yes it is, full of empty :lol: :wink:

_________________
ImageThe happiness is a road...
Not a destination


Top
 Profile  
Reply with quote  
 Post subject: Re: REval v1.05x
PostPosted: Tue Mar 08, 2016 4:21 pm 
Offline
Addict
Addict

Joined: Sun Jun 25, 2006 7:28 pm
Posts: 1293
i have found v1.04 on external hard disk, can't find v1.05.
but it highlights the whole line and not what we want exactly inside the line
http://wikisend.com/download/868550/reval.zip

the instructions
Image

EDit: chrome does not allow downloading the file since it contains reval.exe + reval.pb reval.txt. i am trying to check the file with www.virustotal.com. it is still too busy. may be it is a false positive


Top
 Profile  
Reply with quote  
 Post subject: Re: REval v1.05x
PostPosted: Thu Mar 10, 2016 11:27 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat May 17, 2003 11:31 am
Posts: 6039
Weird. Looks like the archive was empty for some reason. Uploading v1.08 it as we speak. Or type.

_________________
( PB5.xx Win10 x64 Asrock AB350 Pro4 Ryzen 1600X Evo 840 GTX1060 )
( The path to enlightenment and the PureBasic Survival Guide right here... )


Top
 Profile  
Reply with quote  
 Post subject: Re: REval v1.05x
PostPosted: Sat Mar 12, 2016 8:26 am 
Offline
Addict
Addict
User avatar

Joined: Thu Feb 09, 2006 11:27 pm
Posts: 2272
blueznl wrote:
Weird. Looks like the archive was empty for some reason. Uploading v1.08 it as we speak. Or type.


Another miracle, when I download it now, it doesn't contain version 1.08, but 1.09 :mrgreen:


Top
 Profile  
Reply with quote  
 Post subject: Re: REval v1.05x
PostPosted: Sat Mar 12, 2016 12:32 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat May 17, 2003 11:31 am
Posts: 6039
Now you know why I keep a DeLorean in the garage...

_________________
( PB5.xx Win10 x64 Asrock AB350 Pro4 Ryzen 1600X Evo 840 GTX1060 )
( The path to enlightenment and the PureBasic Survival Guide right here... )


Top
 Profile  
Reply with quote  
 Post subject: Re: REval v1.05x
PostPosted: Mon Mar 14, 2016 9:55 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Feb 25, 2013 5:51 pm
Posts: 527
Location: US or Estonia
It's actually impressive OP documents regex better than most regex documentation..

_________________
The truth hurts.


Top
 Profile  
Reply with quote  
 Post subject: Re: REval v1.10
PostPosted: Mon May 29, 2017 1:36 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat May 17, 2003 11:31 am
Posts: 6039
Update 1.10:

- Fixed link to survival guide
- Recompiled with 5.50 x86

Download:

- Changed my homepage but it's still there :-)
- http://www.ninelizards.com/purebasic/pu ... .htm#reval

_________________
( PB5.xx Win10 x64 Asrock AB350 Pro4 Ryzen 1600X Evo 840 GTX1060 )
( The path to enlightenment and the PureBasic Survival Guide right here... )


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: Kukulkan and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye