Imagine that users are inserting strings in several computers.
On one computer, the pattern in the configuration will extract some characters of that string, lets say position 4 to 5. On another computer, the extract pattern will return other characters, for instance, last 3 positions of the string.
These configurations (the Regex patterns) are different for each computer, and should be available for change by the administrator, without having to change the source code.
Some examples:
Original_String Return_Value User1 - abcd78defg123 78 User2 - abcd78defg123 78g1 User3 - mm127788abcd 12 User4 - 123456pp12asd ppsd
Can it be done with Regex? Thanks.
To have a regex capture values for further use you typically use (), depending on the regex compiler it might be () or for microsoft MSVC I think it’s []
Example
is most interesting in that you have here 2 seperate capture areas. Is there some default rule on how to join them together, or would you then want to be able to specify how to make the result?
Perhaps something like
do you want to run a regex to get the captures and handle them yourself, or do you want to run more advanced manipulation commands?