C
cp
If I have a string that looks like this:
Job_x0020_Number
How do I turn that into:
Job Number
?
Job_x0020_Number
How do I turn that into:
Job Number
?
s/(.*)\_[[:xdigit:]]+\_(.*)/$1 $2/;cp said:If I have a string that looks like this:
Job_x0020_Number
How do I turn that into:
Job Number
?
cp said:If I have a string that looks like this:
Job_x0020_Number
How do I turn that into:
Job Number
cp said:If I have a string that looks like this:
Job_x0020_Number
How do I turn that into:
Job Number
Just tested mine, doesn't work if you use leading x for hex number. Changecp said:s/(.*)\_[[:xdigit:]]+\_(.*)/$1 $2/;cp said:If I have a string that looks like this:
Job_x0020_Number
How do I turn that into:
Job Number
?
Uri said:c> s/(.*)\_[[:xdigit:]]+\_(.*)/$1 $2/;
overkill. you don't need to grab and put back the leading and trailing
strings. like gunnar did, just delete the stuff you want to delete.
and _ doesn't need escaping there (or anywhere as it is just a word
char).
so your regex should be:
s/_[[:xdigit:]]+_//;
a lot cleaner and easier to read.
uri
Uri said:c> s/(.*)\_[[:xdigit:]]+\_(.*)/$1 $2/;
overkill. you don't need to grab and put back the leading and trailing
strings. like gunnar did, just delete the stuff you want to delete.
and _ doesn't need escaping there (or anywhere as it is just a word
char).
so your regex should be:
s/_[[:xdigit:]]+_//;
a lot cleaner and easier to read.
uri
c" == cp said:so your regex should be:
s/_[[:xdigit:]]+_//;
a lot cleaner and easier to read.
cp said:If I have a string that looks like this:
Job_x0020_Number
How do I turn that into:
Job Number
Jürgen Exner said:What about
s/_.*_/ /;
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.