I have a regular expression that I'm trying to match with the following data types: each token is separated by an unknown number of spaces.
Refresh : “Text” can be almost any character, so I had it .*originally. It is important to note that it may also contain spaces.
- Text
- Text 01
- Text 01 of 03
- Text 01 (from 03)
- Text 01-03
I would like to write “Text”, “01” and “03” as separate groups, and all but “Text” are optional. The best I've been able to do so far:
\s*(.*)\s+(\d+)\s*(?:\s*\(?\s*(?:of|-)\s*(\d+)\s*\)?\s*)
# 3- # 5 . , , ? , 01 , .
\s*(.*)\s+(\d+)\s*(?:\s*\(?\s*(?:of|-)\s*(\d+)\s*\)?\s*)?
RegEx # 2- # 5, # 2 # 5.
, , .
- RegEx, , : http://regexr.com?2tb64. RegEx .