View Single Post
 
Old 08-16-2022, 02:20 AM
le_robert le_robert is offline Windows 10 Office 2016
Novice
 
Join Date: Jul 2021
Location: France
Posts: 10
le_robert is on a distinguished road
Default Wildcard search for slightly different number formats

Hi,
I have a bunch of chapters and sub-chapters in a book in which the numbering works as follows:

X.X (e.g. 2.1)
X.XX (e.g. 2.11)
X.X.X (e.g. 2.1.1)
X.X.XX (e.g. 2.1.11)
X.XX.X (e.g. 2.11.1)

I want to know if it's possible to do a wildcard search that could capture all these possible combinations (I don't think there's a specific "or" operator). I have an expression that covers the last three but not the first two:
Code:
([0-9]@.[0-9]{1,2}@.)([0-9]{1,2})
Essentially I think I'm looking for something that makes the 3rd section of numbering optional, but to still capture it if it exists.

When I'm dealing with very specific references where I know what comes before and after (like a tab/para mark or specific punctuation/text) I can modify it to cover everything, but I'm looking for something that would pick it up under (almost) all circumstances. My instinct is that it's not possible, but would like confirmation from an expert before I give up!

Thanking you in advance
Reply With Quote