Hi, All, 

I am new to Julia from Matlab. I am learning regular expression today. 

Here is an example: 

First, I'd like to high-lighten the word "goat" and "boat" in the sentence 
"a goat in a boat". 

x = "oat";
reg = Regex("(\\w+(?>$x))");

y = "a goat in a boat";
z = replace(y, reg, s"*\g<1>*")   

The result is: 
"a *goat* in a *boat*"

Then, I'd like to covert these two words into uppercase, that is, to get a 
new string of "a GOAT in a BOAT". 

I expect that Julia might have something like this:  z = replace(y, reg, 
s"$(uppercase(\g<1>))"). but it does not work. 

So, Here is my questions:  How to have a Function call as replacement in 
the regular expression? 

Thanks, 

Yunde

Reply via email to