When running a Perl one-liner on a non-Windows system you will probably need to change the double quotes (") to single quotes ('). Check the requirements of the particular shell you’re using to run perl.
But I only used a one-liner as a quick way to demonstrate the technique you can use. Once you have the match (say, in $1), you can find where in the original string it matched using index. This will work regardless of the number of characters in the string or in the match.
Note that the values returned by index are zero-based; that is, if the match begins on the first character of the original string, index returns zero. If the substring is not found within the original string, index returns -1.
Athanasius <°(((>< contra mundum
|