Monks,
I have an academic regex question. I was trying to convert an ip to a hex number, for say, solaris jumpstarts, doing
echo 123.45.67.890 | perl -ne '/(\d+)\.(\d+)\.(\d+)\.(\d+)/;printf "%X%X%X%X\n",$1,$2,$3,$4easy enough. Question is, Is there a way to get the values expanded from a quantifer? Say something like..
echo 123.45.67.890 | perl -ne '/((\d+)\.?/{1,3}/;printf "%X%X%X%X\n",$1,$2,$3,$4'Which obviously does not work.. but shows the type of thing I want to know.. Are there implicit variables there and if so how can you access them?
In reply to extracting variables from regex by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |