Im trying to convert a Ruby file to Python using a parser.
For example parsing 'myvar.to_s' in ruby will give 'str(myvar)' in python.
In my Ruby parser I do it like this:
@line.gsub!(/(\S+)\.to_s/,'str(\1)')
using the method:
def to_s return @lineend
Now I could like to do the same for parsing a ruby line of code that is used to match a regular expression (RegExp):
mystring =~ /myregex_(.*?)/i
This would translate in python like this :
mystring = re.search(r'myregex_(.*?)', mystring, re.IGNORECASE)
I dont know how to do this in Ruby, and Im not sure if it is even possible.