PureBasic Forum
https://www.purebasic.fr/english/

REval v1.05x
https://www.purebasic.fr/english/viewtopic.php?f=14&t=43599
Page 1 of 1

Author:  blueznl [ Sun Sep 12, 2010 9:34 pm ]
Post subject:  REval v1.05x

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'

Author:  Michael Vogel [ Wed Sep 15, 2010 9:01 am ]
Post subject:  Re: REval v1.04x

Hi Blueznl,
no source code inside? :shock:

Author:  blueznl [ Wed Sep 15, 2010 3:19 pm ]
Post subject:  Re: REval v1.04x

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.

Author:  blueznl [ Thu Sep 16, 2010 11:34 am ]
Post subject:  Re: REval v1.04x

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.

Author:  blueznl [ Sun Feb 05, 2012 5:23 pm ]
Post subject:  Re: REval v1.04x

Updated to v1.05x.

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

Author:  Amundo [ Thu Feb 09, 2012 11:48 pm ]
Post subject:  Re: REval v1.05x

Thanks blueznl, nicely done (as always), thanks for sharing the source as well.

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

Author:  blueznl [ Tue Jul 30, 2013 11:18 pm ]
Post subject:  Re: REval v1.05x

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 :-)

Author:  Michael Vogel [ Mon Mar 07, 2016 4:57 pm ]
Post subject:  Re: REval v1.05x

Hi Blueznl,
maybe someone has downloaded your program, it seems so, that is has gone... :shock:

Author:  Kwai chang caine [ Tue Mar 08, 2016 9:33 am ]
Post subject:  Re: REval v1.05x

Yes it is, full of empty :lol: :wink:

Author:  applePi [ Tue Mar 08, 2016 4:21 pm ]
Post subject:  Re: REval v1.05x

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

Author:  blueznl [ Thu Mar 10, 2016 11:27 pm ]
Post subject:  Re: REval v1.05x

Weird. Looks like the archive was empty for some reason. Uploading v1.08 it as we speak. Or type.

Author:  Michael Vogel [ Sat Mar 12, 2016 8:26 am ]
Post subject:  Re: REval v1.05x

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:

Author:  blueznl [ Sat Mar 12, 2016 12:32 pm ]
Post subject:  Re: REval v1.05x

Now you know why I keep a DeLorean in the garage...

Author:  tj1010 [ Mon Mar 14, 2016 9:55 pm ]
Post subject:  Re: REval v1.05x

It's actually impressive OP documents regex better than most regex documentation..

Author:  blueznl [ Mon May 29, 2017 1:36 pm ]
Post subject:  Re: REval v1.10

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

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/