Which RegEx syntax does Gramps use?

There are evidently a variety of standard syntaxes for RegEx. Which Regular Expressions standard (and possibly , which sub-dialect) was implemented in Gramps?

I’m guessing that it is the POSIX rather than Perl. But there are 3 compliance levels of the IEEE POSIX syntax: BRE (Basic Regular Expressions), ERE (Extended Regular Expressions), and the deprecated SRE (Simple Regular Expressions)

If a person is looking for tutorials and cheatsheats on the net, it would be helpful to be certain of which they should be seeking.

Where did you found the SRE is deprecated ?
The differences between all these syntaxes are very minimal (escape some characters)

For gramps we don’t need to know the differences.

Perhaps you don’t understand how it works.
I use regexp every days with gramps, sed, grep and found no differences in a standard usage.

You have the resonse in the re.py file distributed by python

You have the following page in gramps documentation:

The Wikipedia page. It states SRE is deprecated in favor of BRE.

There are entire Books & Websites dedicated to mastering RegEx.

Adding syntax tutorials to the Gramps wiki is reinventing the wheel.

So, we don’t need a wiki anymore.

No. It just doesn’t make sense for the syntax RegEx. For the general syntax tutorial, we can suggest an appropiate external webpage in the See Also section. (We need a Gramps RegEx user to suggest a good external webpage with the right dialect of RegEx!)

Tutorials on the application of RegEx for Gramps data makes sense.

But adding tutorials on RegEx syntax would be like adding wiki tutorial on your OS or learning Python. These are already done better elsewhere. The wiki should only address how to they relate in an unusual way to Gramps.

If there is no difference, why are there different specifications that are still being maintained separately?

Gramps uses the Python version of regular expressions re — Regular expression operations — Python 3.10.2 documentation

I could not find any reference to suggest that it follows any of the POSIX levels, although for the usage of our filters I suspect that this doesn’t matter.

I think that for the vast majority of likely re used in Gramps, the relatively minor variations in syntax just doesn’t matter. I suppose that a very advanced user might be able to find some expression where it does; but I also suspect that user could read the Python docs to get the details.

Note in the documentation that the Python version of re has changed over time, usually in a backward compatible fashion. So the actual syntax of Gramps would be that of the version of Python that you have installed to run Gramps.

1 Like

I cannot help that the term “RegEx” always reminds me of a 2 second video clip from the “Wolf In the Fold” Star Trek (TOS) episode.

in the documentation you cited, the following note is in the opening section of the docs.

See also

The third-party regex module, which has an API compatible with the standard library re module, but offers additional functionality and a more thorough Unicode support.

Given that Gramps is heavy in Unicode use (and the recent inquiry about Case Sensitivity not being controllable), is that third-party regex more appropriate for Gramps than the standard library re module?