How does one extract the middle of a string with a regular expression, given the characters before and after the substring desired? For example, let's say I need to isolate all characters between "abc" and "xyz"...
I can do this with index and substr, but regex has got to be more efficient. Thanks in advance :)$foo = "abchelloxyz"; $bar = /regex on $foo/; # $bar = "hello"
In reply to regex: extract a substring by Galen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |