Reputation: 1627
I'm trying to compare two lists and would like to use regular expression to do just that. Accordingly, I'd like to loop through the elements of one list and compare it to each of the elements in the other list. I can't seem to figure out how to make my regular expression contain a variable. Hopefully, this code should elucidate the matter:
string1="chase"
string2="chasecb"
m=match(r"$string1" ,string2)
println(m)
I know that the $ is a regular expression metacharacter and I've tried escaping it and various permutations of that idea and so forth. Is there another way? Thanks so much.
Upvotes: 7
Views: 6320