Is there anyway I can get the value 'blah1' and 'test'? I need to get the value between the '-' and '.jpg' . If you can, please help and thank you so much for reading.
match any character which is not a minus any number of times
Code:
-
match a minus sign
Code:
(
start collecting into $1
Code:
[^.]+
match anything other than a period one or more times
Code:
)
stop collecting into $1
Code:
\.
match a literal period
Hope this helps,
Yours,
fish
"As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs."
--Maurice Wilkes
Using Rieekan's approach above:
[tt]
$_="PC-blah1.jpg";
/-/; # find the /
$_=$'; # save everything after it
/\./; # find the .
$_=$`; # save everything before it
print; # print result
[/tt]
Mike
Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884
It's like this; even samurai have teddy bears, and even teddy bears get drunk.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.