Say I have a string like {{ComputersRule}} and a regex like: [^\}]+. How would I get regular expressions to start at a specified point in the string, i.e. Once it has reached the third character in the string. If it’s relevant, and I doubt it is, I’m working in Python version 2.7.3. Thank you.
Say I have a string like {{ComputersRule}} and a regex like: [^\}]+ . How
Share
I’d recommend using Python to grab the substring from the third character onwards, and then apply the regex to the rest.
Otherwise, you could just use the regex
.(any character except newline) to gobble up the firstncharacters:Notice the
^.{3}which forces the[^\}]+to not include the first three characters of the string (the^anchors to the start of the string/line). The brackets capture the bit you want to extract (so get capturing group 1).In your particular case, if it’s just a case of “I want the text inside the
{{and}}” you could do\{\{([^\}]+)\}\}or[^\{\}]+.