T
Tad McClellan
Tajana said:1.) How to extract telephone number from string.
Form for telephone number is XXX/XXXX-XXX or XXX/XXX-XXX or XX/XXXX-XXX, so
I have problem with different number format.X is for numeric
3 / 4 - 3
m#\d{3}/\d{4}-\d{3}#g
or 3 / 3 - 3
m#\d{3}/\d{3}-\d{3}#g
or 2 / 4 - 3 number character
m#\d{2}/\d{4}-\d{3}#g
2.) How to check position of pattern in some string
Eg.
$pattern ="my";
That isn't much of a pattern. It looks like a constant string.
$string= "my dog is my pet";
Answer is: 0 , and 10
perldoc -f index
Or if you really meant for $pattern to be a pattern:
perldoc -f pos