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:
https://gramps-project.org/wiki/index.php/Gramps_5.1_Wiki_Manual_-_Filters

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.

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.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.