I am new to python and i am trying to lean how regexs work. I would like to capture everything after the GT in this string:
string = re.search(r"(GT\\s*)(.)\\n", notes)
thanks for the help!
Edit: I would like the output to look like this:
\\s*)(.)\\n", notes)
Use the following:
s = 'string = re.search(r"(GT\s*)(.)\n", notes)'
m = re.search(r'GT(.*)', s, re.DOTALL)
print(m.group(1))
The output (contains line-break according to \\n
presence):
\s*)(.)
", notes)
in below example every thing catch after @
>>>import re
>>>re.findall(r'@(\w+)', '@hi there @kallz @!')
>>>['hi', 'kallz']
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.