parameter
In Sublime Text 3 I am using the following RegEx code as my search combo to find any alphabet character preceding 0, followed by a space, followed by another character which is as follows:
RegEx Code
[a-z]0 [a-z]
Search Target Examples
Eg.1 a0 p
Eg.2 p0 sa
Eg.3 ap0 l
Question:
What RegEx code should I write so that it replaces all such occurrences containing the 0s with a dot (.) i.e., it should become like this:
Replace Objective of Target Examples
Eg.1 a0 p → a. p
Eg.2 p0 s → p. sa
Eg.3 ap0 l → ap. l
Use capturing groups and backreferences:
Regex:
([a-z])0( [a-z])Replacement:
$1.$2See the regex demo
Details:
([a-z])- matches and captures into Group 1 any ASCII lowercase letter0- a literal0is matched( [a-z])- Group 2: a space and a lowercase ASCII letterThe replacement contains the backreference to the value stored in Group 1 (
$1), then we replace0with a dot, and use the backreference to Group 2 contents ($2).