El martes, 17 de marzo de 2015, 15:14:35 (UTC-6), Julia User escribió: > > How to use a julia variable in a regex string (interpolate). > > var = " " > reg = r"^$(var)+" # Something like this > result = matchall(reg, mystring) > > > Is there a way to make this work? >
How about the following? I don't know if there's a shorter way. var = " " reg_string = "^$(var)+" # standard Julia string reg = Regex(reg_string) # make a regular expression out of the string result = matchall(reg, mystring) Best, David. > > Thanks > > > >
