Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (["'])(?:(?=(\?))2.)*?1
- "(.*?)"
- >>> import re
- >>> string = '"Foo Bar" "Another Value"'
- >>> print re.findall(r'"(.*?)"', string)
- ['Foo Bar', 'Another Value']
- "([^"]*)"
- ["'](?:(?<=")[^"\]*(?s:\.[^"\]*)*"|(?<=')[^'\]*(?s:\.[^'\]*)*')
- (?=["'])(?:"[^"\]*(?:\[sS][^"\]*)*"|'[^'\]*(?:\[sS][^'\]*)*')
- "[^"\]*(\(.|n)[^"\]*)*"|'[^'\]*(\(.|n)[^'\]*)*'
- "([^"\]|\.|\n)*"|'([^'\]|\.|\n)*'
- ("[ws]+")
- (?<=(["']b))(?:(?=(\?))2.)*?(?=1)
- /(["'])((?:(?!1)[^\]|(?:\\)*\[^\])*)1/
- foo "string \ string" bar
- foo "string1" bar "string2"
- # opening quote
- (["'])
- (
- # repeat (non-greedy, so we don't span multiple strings)
- (?:
- # anything, except not the opening quote, and not
- # a backslash, which are handled separately.
- (?!1)[^\]
- |
- # consume any double backslash (unnecessary?)
- (?:\\)*
- |
- # Allow backslash to escape characters
- \.
- )*?
- )
- # same character as opening quote
- 1
- string = "" foo bar" "loloo""
- print re.findall(r'"(.*?)"',string)
- reg = r"""(['"])(%s)1"""
- if re.search(reg%(needle), haystack, re.IGNORECASE):
- print "winning..."
- echo 'junk "Foo Bar" not empty one "" this "but this" and this neither' | sed 's/[^"]*"([^"]*)"[^"]*/>1</g'
- |(['"])(.*?)1|i
- preg_match_all('|(['"])(.*?)1|i', $cont, $matches);
- Sub TestRegularExpression()
- Dim oRE As VBScript_RegExp_55.RegExp '* Tools->References: Microsoft VBScript Regular Expressions 5.5
- Set oRE = New VBScript_RegExp_55.RegExp
- oRE.Pattern = """([^""]*)"""
- oRE.Global = True
- Dim sTest As String
- sTest = """Foo Bar"" ""Another Value"" something else"
- Debug.Assert oRE.test(sTest)
- Dim oMatchCol As VBScript_RegExp_55.MatchCollection
- Set oMatchCol = oRE.Execute(sTest)
- Debug.Assert oMatchCol.Count = 2
- Dim oMatch As Match
- For Each oMatch In oMatchCol
- Debug.Print oMatch.SubMatches(0)
- Next oMatch
- End Sub
- (["'])(?:\1|.)*?1
- (["'])((?:\1|.)*?)1
- (['"])(?:(?!1|\).|\.)*1
- (?<=(['"])b)(?:(?!1|\).|\.)*(?=1)
Add Comment
Please, Sign In to add comment