For one thing, I only want to extract the YY..Y part of the string. The regular expression should contain a statement that identifies the variable of type Y by its adjacency to Z, but only returns the Y.
Actually, I was looking for a regular expression to extract Y...Y (as many consecutive instances of the variable of type Y following Z as there are).
Would just =~ /\S+Z(Y+)\g
print $1
work (it doesn't in the code).
Thanks, Max
Suppose I have strings of the form:
xxxxxxxxxxZYYYxxxxxx
where x can be any character, Z is some specific character, and Y is a certain character type (i.e. digits) of arbitrarily length. I want to exploit the fact that substring Y...Y always appears after Z, and write a regular expression that...
Thank you.
Sorry for the naive question, but if I understand it correctly, the construct ${1} means taking a single instance of the regular expression and assigning it to the substring ${1}?
Basically, I am trying to construct a substitute expression that accomplishes the following: given all occurrences of a certain type of string (for instance, digits), insert some prefix or suffix before or after all occurences.
For example, in the string --12***345)))6789?<>, I want to insert...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.