Skip to content

Adding support for group matches in complexSymbols? #11107

@sthibaul

Description

@sthibaul

Hello,

In e.g. source/locale/fr/symbols.dic, we have

dates .	((?<=\b\d\d)\.(?=\d\d.(\d{2}|\d{4})\b))|((?<=\b\d\d.\d\d)\.(?=(\d{2}|\d{4})\b))
dates .	 	all	always	# point de date

so as to remove dots from the dates. This is relatively complex, and could be much better written with matching groups:

dates .	\b(\d\d)\.(\d\d)\.(\d{2}|\d{4})\b
dates .	\1 \2 \3 	all	always	# point de date

It would allow to write more easily such rules like:

price	\b(\d\+),(\d\+)\s?€\b
price	\1 euros \2	all	always	# prix à virgules

etc.

I would be just a few lines more in _regexpRepl to perform the group replacement, I can work on it if the principle is Ok? (basically it means making the replacement string interpret \ characters, thus allowing for this feature, and possibly even more in the future)

Samuel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions