I want to reduce following to substitutions into one, is that possible?
"g" matches globally, eg. if I have "camelCase" then first substitution ends with "CAMEL_CASE_". I want to save 2nd substitution. Names can be any length in runtime, ie. such as "namesCanBeDifferentAny" etc. Is there a way to stop regexp engine in the (n-1)th match, providing that there are n matches?# convert medial capital into capital separated by "_" $str =~ s/([a-z]+)/sprintf(uc($1)."_")/ge; $str =~ s/_$//;
In reply to global match except last one by utku
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |