jay_waugh
asked on
Find and replace Regex
I am looking to replace the value between two spaces in a string with a backslash. Can someone assist with the syntax.
E.G. I want
RED 123456789 White
to become
RED\White
Thanks
E.G. I want
RED 123456789 White
to become
RED\White
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What specifically isn't working for you?
I replaced the "regex" tag with "regular expressions"
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks both for your feedback.
My question is as simple as this. "Without using variables can I use a single regular expression to update a string so that the value held between two space characters is modified to be a backslash"
e.g.
RED 123456789 White = RED\White
or
Tree thebranchesof Bark = Tree\Bark
My question is as simple as this. "Without using variables can I use a single regular expression to update a string so that the value held between two space characters is modified to be a backslash"
e.g.
RED 123456789 White = RED\White
or
Tree thebranchesof Bark = Tree\Bark
Not sure what you mean by without using variables? In the first reply to this question by aikimark there were no variables used.
You use the words "update a string" but the only way to update something is to have it in a variable. You can start with one value and produce a new value from it, which is what aikimark showed. Or you can start with a value in a variable and update that, which is what I showed.
If you are looking for something different not sure what you need. Can you show the code you imagine?
»bp
You use the words "update a string" but the only way to update something is to have it in a variable. You can start with one value and produce a new value from it, which is what aikimark showed. Or you can start with a value in a variable and update that, which is what I showed.
If you are looking for something different not sure what you need. Can you show the code you imagine?
»bp
ASKER
OK thanks Bill, looks like I will have to go back to the drawing board a little and then be more specific
ASKER
Sadly that doesn't seem to work for me. I am looking for a single line of regex. Apologies if any confusion has been caused by the Python reference on the this ticket, but the Experts Exchange window didn't seem to accept just "Regex"