Is it possible to have a ternary expression within the replacement bit of the regular expression? I've the following code and I'm trying to fix the size of font (captured in $1) if it's greater than 5:
Thanks in advance :)$message =~ s~\[size=(.+?)\](.+?)\[/size\]~'<font size="' . $1 . '">' + . "$2</font>"~eisg; # I'm trying to test $1 so that if it's greater than 5, # fix it at 5, else leave it unchanged.
In reply to Ternary inside a regex by kiat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |