Info about Regular Expressions (1 Viewer)

Tessa

Registered User.
Local time
Today, 08:38
Joined
Nov 15, 2018
Messages
24
Sure. Here they are.

VBA Regular Expressions

Regular Expressions Reference

Differences between the flavors of Regular Expressions


The products:

PowerGREP

RegexBuddy

I haven't tried RegexBuddy yet because there is no free trial version of it. I have only been using PowerGREP for a couple of days and I am already very impressed. I certainly will buy it when the 15 days trial period expires. I also intend to buy RegexBuddy and when I do I will post a review of it, if that is OK on this site.
 

isladogs

MVP / VIP
Local time
Today, 07:38
Joined
Jan 14, 2017
Messages
18,216
Re: Hello from Denmark

Thanks for that

The site isn't intended for reviews of commercial products.
However, comments like those you have just made are perfectly acceptable at this forum.

However another well known Access forum would almost certainly have censored your post or deleted it in case it was viewed as advertising.

for example, someone mentioned a free Access add-in that they had made available from GitHub. The post was accepted here but deleted at the other forum.

As an infrequent user of RegEx, perhaps you could explain in general terms to anyone interested, what benefits such products provide ....if its possible to do that without plugging specific products ;)

Actually could you do that in a new thread - as the Intro thread isn't intended for technical matters.
I could move your last post to that new thread if you wish .... but another member (mentioning no names AB!) will complain that I'm censoring you.
 

Tessa

Registered User.
Local time
Today, 08:38
Joined
Nov 15, 2018
Messages
24
Re: Hello from Denmark

Your suggestion about moving my previous post to a separate thread sounds like a good idea and I wouldn't feel that you are censoring me. So please do so.

I wouldn't mind writing an introduction to RegEx but Mr. Wells is doing that much better than I could ever do.

I will mention though that those of you using Microsoft Word or any other application from the Office Suite have access to something that is similar to RegEx. You can read about Word's concept of regular expressions here

I am pretty sure that the VBA compiler is using a regular expression when it parses our VBA code. One task of the VBA compiler for example is to recognize numeric literals like
Code:
'
.25 or 0.25
-11
+314e-2
0.00059E5  '(my age in a non user friendly form)
The regular expression matching any numeric literal could look something like this
Code:
(\+|-)?(\d+\.|\d+|\.)(\d+)?((e|E)(\+|-)?(\d+))?
Not very user friendly and not very self-explanatory but extremely powerful. When you ask RegEx to find occurrences of numeric literals using the pattern above, for each match you have access to the following information:
  • starting position in the source of the match
  • length of the match
  • whether the optional sign is specified and if so, it tells you whether it is + or -
  • the integral part of the number if any
  • the decimal part of the number if any

RegEx also tells you whether the optional exponent is specified and if so you have access to the following information about the exponent
  • whether the optional sign is specified and if so, whether it is + or -.
  • the value of the exponent
Pretty impressing I think that it is possible to get that much information using only 47 characters.

The expression I was struggling with when I asked if anybody had any experience with regular expressions looks like this
Code:
%(\+|-?)(\d+)?(\{([\w\W])(,([\w\W]))?\})?('\{([^\}]+)\})?(\{([^\}]+)\}|(s))
I tell you, regular expressions has caused me to tear my hair out many many times throughout the years. But it is a great triumph when, or should I say if:), you manage to make your regular expression to fall into line. The same feeling I imagine you get when you solve a develish Sudoku.

I have been especially fascinated by two technologies in my career as a developer. Regular expressions is one of them.

PS: I imagine that this post also belongs to the new Regular Expression thread you mentioned.
 

isladogs

MVP / VIP
Local time
Today, 07:38
Joined
Jan 14, 2017
Messages
18,216
New thread created as requested.
I had a quick look at those links & i'm sure they will be useful to many forum users
 

NauticalGent

Ignore List Poster Boy
Local time
Today, 02:38
Joined
Apr 27, 2015
Messages
6,331
Maybe a new Section in the Apps threads for Regular Expressions...?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 01:38
Joined
Feb 28, 2001
Messages
27,172
For those of you with a different background, regular expressions are templates for parsing. You remember parsing from grade school, where you take apart a sentence and identify the subject, object, verb, adjectives, adverbs, and interjections. Plus, of course, for compound sentences, you need conjunctions. You might not have called it that, but when I was in grade school, we parsed sentences to learn parts of speech and their functions.

Parsing for computer languages does that a little differently. It finds constants, variable names, math or logic operators, grouping symbols, and functions. The first part of the work of VBA is to identify all those things. The second part is to put them together to generate the computer equivalent of those symbolic things - called "semantics." In a very simplistic sense, "syntax" is what it said; "semantics" is what it meant. And parsing deals with syntax. If you have ever studied finite automata theory then this topic crops up all the time.

Regular expression utilities come into play because you can create a type of shorthand specification to feed to a regular expression analyzer as a template and then have it return to you the elements of an input sequence that match the template. This type of utility is absolutely invaluable in the field of data mining.
 

NauticalGent

Ignore List Poster Boy
Local time
Today, 02:38
Joined
Apr 27, 2015
Messages
6,331
This type of utility is absolutely invaluable in the field of data mining.

Say that again and the truth shall set you free!
 

Users who are viewing this thread

Top Bottom