[Solved] strange regex experasion [closed]
Try it out on regex101.com, looking on the right side: Hope you can see this ok and can grok it. solved strange regex experasion [closed]
Try it out on regex101.com, looking on the right side: Hope you can see this ok and can grok it. solved strange regex experasion [closed]
You’re asking to match any number of lines of text, followed by only 1 additional newline at the end, simply: ^(.+\n)+\n(?!\n) will do what you’d like. Example here: https://regex101.com/r/Hy3buP/1 Explanation: ^ – Assert position at start of string (.+\n)+ – Match any positive number of lines of text ending in newline \n – Match the … Read more
You might try: ^(?!((\\d{9})|(\\d{3}-\\d{2}-\\d{4})|(\\d{3}-\\d{3}-\\d{3}))$).* To explain, if we read the query you provided: ^((?!\\d[9]$)|(?!(\\d{3}-?\\d{2}-?\\d{4}$)|(?!(\\d{3}-?\\d{3}-?\\d{3})$)$ We could read that: is not followed by xxxxxxxxx OR is not followed by xxx-xx-xxxx OR is not followed by xxx-xxx-xxx (in my version at the top, I rephrased this to be: is not (xxxxxxxxx OR xxx-xx-xxxx OR xxx-xxx-xxx).). Any string … Read more
#!/usr/bin/python2 # -*- coding: utf-8 -*- import re text=”{[FACEBOOK23.1K],[UNKNOWN6],[SKYPE12.12M]}”; m = re.findall(‘\[([a-z]+)([^\]]+)\]’, text, re.IGNORECASE); output=”{“; i = 0 for (name,count) in m: if i>0: output += ‘,’ output += “[“+name+”,”+count+”]” i=i+1 output += ‘}’ print output 4 solved Regex to seperate a work and decimal number