The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,230 other followers

Delphi TRegExOption: Where is description of roNotEmpty option? What does this option do? – Jacek Laskowski – Google+

Posted by jpluimers on 2020/12/10

I really dislike using regular expressions, mainly because every time I bump into code using them either:

  • I cannot decipher them any more
  • It is used for things not suites for (like parsing JSON or XML: please don’t!)

For more background on when NOT to use regular expressions, remember they describe a regular grammar, and can only me implemented by a finite state machine (a state machine that can be exactly one state out of a set of finite states).

As soon as you need to parse something that needs multiple states at once, or the number of states becomes infinite,

Some background reading:

 

 

But it helps knowing that stuff means in the various environments you use, so [WayBack] Delphi TRegExOption: Where is description of roNotEmpty option? What does this option do? – Jacek Laskowski – Google+:

In TregEx.Create:

if (roNotEmpty in Options) then
  FRegEx.State := [preNotEmpty];

preNotEmpty is a TPerlRegExState which is defined as:

TPerlRegExState = set of (
  preNotBOL, // Not Beginning Of Line: ^ does not match at the start of Subject
  preNotEOL, // Not End Of Line: $ does not match at the end of Subject
  preNotEmpty // Empty matches not allowed
);

So roNotEmpty seems to indicate that empty matches are not allowed.

–jeroen

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
%d bloggers like this: