This regex should match the target:
[0-9]+x[0-9]+
So this should work to remove everything else:
Search: .*[0-9]+x[0-9]+.*
Replace (perl etc): \1
Replace (java): $1
質問
I ask my first question here because I need to isolate some characters in
Fri 2 Mar 2012 11:14:25
JPEG **960x640** 960x640+0+0 8-bit sRGB 64.7KB 0.016u 0:00.017
I want isolate 960X640
but this variable can change every time :(
And the result I got is on many line like the example.
So I need a regex to delete all before 960X640 and all after.
Thank you so much if you try to help me :)
解決
This regex should match the target:
[0-9]+x[0-9]+
So this should work to remove everything else:
Search: .*[0-9]+x[0-9]+.*
Replace (perl etc): \1
Replace (java): $1
他のヒント
Sed would use syntax like:
s/^[^0-9]+[[:space:]]([0-9]+x[0-9]+)[[:space:]].*$/\1/
Perl would look like:
s/^\D+\s([0-9]+x[0-9]+)\s.*$/$1/
For example:
$ echo 'JPEG 960x640 960x640+0+0 8-bit sRGB 64.7KB 0.016u 0:00.017' | sed -r 's/^[^0-9]+[[:space:]]([0-9]+x[0-9]+)[[:space:]].*$/\1/'
960x640
This must solve your problem:
/\d+x\d+/