what happen if i only want match one character in a specific position of one string line? what Regex xpresion could i use?
for example:
i want to mach if in the last position (in this case 5) is the letter "E", and replace it with "e"
HOUSE -- HOUSe
also.. the [DEL] display command, only "remove" the last character from the first line, so if i have this string "abc", the [DEL] command only do this "abc" - "ab_" - "a_ _" - "_ _ _", what happen if i want do that in reverse? "_ bc" - "_ _ c" - "_ _ _"
there are any RegEx expresion i can use?
I haven't tested yet, but based on the RegEx page that Bench linked above, this might be worth a try:
Code:
[REPLACEFIRST]^\S{4}\G\S[WITH]e
How it is supposed to work:
The carat refers to the beginning of the line.
The backslash-S refers to any non-space character (alphanumeric, plus maybe special characters.)
The 4 sandwiched between curly-braces counts out exactly four of those non-space characters.
The backslash-G refers to a meta command to go to the end of the current match (the four non-space characters).
The backslash-S finds the fifth non-space character. This should be the only character selected at this point.
That fifth character should get replaced with "e".
Alternatively, if you do want to find an "E" at the end of the line, Malacodor's "E$" should find it.
For deleting in reverse, it may be worth a try to use the "counting" trick above.
Example to delete the first character of a line:
Code:
[REPLACEFIRST]^\S{1}[WITH][]
Note that there is nothing between the matching pair of square brackets after the "WITH" keyword. That first non-space character should simply be gone.
Example to delete the first two characters of a line:
Code:
[REPLACEFIRST]^\S{2}[WITH][]
Note that there is nothing between the matching pair of square brackets after the "WITH" keyword. Those first two non-space characters should simply be gone.
Try these out and let us know how it goes.