Consider the following scenario:
b*any string here*
If this pattern is present, I would like to substitute b* at the beginning with <b>
, and the * at the end with </b>
(Ignore the backslash for SO site escaping).
It's possible that there are multiple occurrences:
b*any string here* and then b*string b*.
However, these cases should not be addressed:
b*foo bar
foo bar*
bb*foo bar* (b does not follow a space or start of string).
Here is what I have so far:
(?<=b\*)(.*?)(?=\*)
While this provides the text between, I am encountering challenges in making the replacement.