Save & Share

Flavor

  • PCRE2 (PHP)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java
  • .NET 7.0 (C#)
  • Rust
  • PCRE (Legacy)
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests
Sponsors
There are currently no sponsors. Become a sponsor today!
An explanation of your regex will be automatically generated as you type.
Detailed match information will be displayed here automatically.
  • All Tokens
  • Common Tokens
  • General Tokens
  • Anchors
  • Meta Sequences
  • Quantifiers
  • Group Constructs
  • Character Classes
  • Flags/Modifiers
  • Substitution
  • A single character of: a, b or c
    [abc]
  • A character except: a, b or c
    [^abc]
  • A character in the range: a-z
    [a-z]
  • A character not in the range: a-z
    [^a-z]
  • A character in the range: a-z or A-Z
    [a-zA-Z]
  • Any single character
    .
  • Alternate - match either a or b
    a|b
  • Any whitespace character
    \s
  • Any non-whitespace character
    \S
  • Any digit
    \d
  • Any non-digit
    \D
  • Any word character
    \w
  • Any non-word character
    \W
  • Non-capturing group
    (?:...)
  • Capturing group
    (...)
  • Zero or one of a
    a?
  • Zero or more of a
    a*
  • One or more of a
    a+
  • Exactly 3 of a
    a{3}
  • 3 or more of a
    a{3,}
  • Between 3 and 6 of a
    a{3,6}
  • Start of string
    ^
  • End of string
    $
  • A word boundary
    \b
  • Non-word boundary
    \B

Regular Expression
Processing...

Test String

Code Generator

Generated Code

import Foundation let pattern = #"(?<="value":")(.*?)(?=",)"# let regex = try! NSRegularExpression(pattern: pattern) let testString = #""" </ac:layout-cell></ac:layout-section><ac:layout-section ac:type=\"two_equal\"><ac:layout-cell><h4>Deployed Services</h4><table style=\"line-height: 1.42857;\"><thead><tr><th><div class=\"tablesorter-header-inner\">Component</div></th><th><div class=\"tablesorter-header-inner\">Version (click for release notes)</div></th><th><div class=\"tablesorter-header-inner\">Deployed on</div></th></tr></thead><tbody><tr><td>fs-newarch-proxy</td><td>3.0.10.86</td><td><p><span>2016/06/15 7:30am</span></p></td></tr><tr><td colspan=\"1\">fs-newarch-client-proxy</td><td colspan=\"1\">3.0.10.53</td><td colspan=\"1\"><span>2016/06/03 1<span>:30pm</span></span></td></tr><tr><td colspan=\"1\">fiws-proxy</td><td colspan=\"1\"><span>3.0.10.35</span></td><td colspan=\"1\"><span>2016/06/03 11:30<span>am</span></span></td></tr><tr><td colspan=\"1\">fdsm-ocs-proxy</td><td colspan=\"1\">3.0.10.2</td><td colspan=\"1\">2016/06/20 12:30pm</td></tr><tr><td colspan=\"1\">fs-container</td><td colspan=\"1\">1.3.10</td><td colspan=\"1\"><span>2016/06/20 4:00pm</span></td></tr><tr><td colspan=\"1\">fs-persistence</td><td colspan=\"1\">1.0.9</td><td colspan=\"1\"><span>2016/04/25 11:30am</span></td></tr><tr><td colspan=\"1\">fs-monitoring</td><td colspan=\"1\">1.2</td><td colspan=\"1\">2016/04/27 11:00am</td></tr><tr><td class=\"highlight-grey\" colspan=\"1\" data-highlight-colour=\"grey\">&nbsp;</td><td class=\"highlight-grey\" colspan=\"1\" data-highlight-colour=\"grey\">&nbsp;</td><td class=\"highlight-grey\" colspan=\"1\" data-highlight-colour=\"grey\">&nbsp;</td></tr><tr><td colspan=\"1\">fs-account-maint-2</td><td colspan=\"1\">2.12</td><td colspan=\"1\"><span>2016/06/20 12:00pm</span></td></tr><tr><td colspan=\"1\">fs-account-search-3</td><td colspan=\"1\">3.2.9</td><td colspan=\"1\"><span>2016/06/08 4:00pm</span></td></tr><tr><td colspan=\"1\"><span>fs-account-search-4</span></td><td colspan=\"1\"><p>4.12</p></td><td colspan=\"1\"><span>2016/06/20 12:00pm</span></td></tr><tr><td colspan=\"1\">fs-core-2</td><td colspan=\"1\"><span>2.9</span></td><td colspan=\"1\"><span>2016/06/20 12:00pm</span></td></tr><tr><td colspan=\"1\">fs-fiws-services-2</td><td colspan=\"1\">2.18</td><td colspan=\"1\"><span>2016/06/20 12:00pm</span></td></tr><tr><td colspan=\"1\">fs-memos-1</td><td colspan=\"1\"><span>1.82</span></td><td colspan=\"1\"><span>2016/06/20 12:00pm</span></td></tr><tr><td colspan=\"1\">fs-secureconfig-2</td><td colspan=\"1\">2.215</td><td colspan=\"1\"><span>2016/06/20 12:00pm</span></td></tr><tr><td colspan=\"1\">fs-statements-1</td><td colspan=\"1\">1.69</td><td colspan=\"1\"><p><span>2016/06/08 11:00am</span></p></td></tr><tr><td colspan=\"1\">fs-statements-2</td><td colspan=\"1\">2.72</td><td colspan=\"1\"><span>2016/06/20 12:00pm</span></td></tr><tr><td colspan=\"1\">fs-token-3</td><td colspan=\"1\">3.213</td><td colspan=\"1\"><span>2016/06/20 12:00pm</span></td></tr><tr><td colspan=\"1\">fs-token-4</td><td colspan=\"1\">4.216</td><td colspan=\"1\">2016/06/22 3:00pm</td></tr><tr><td colspan=\"1\">fs-ui-services-2</td><td colspan=\"1\">2.9</td><td colspan=\"1\"><span>2016/06/20 12:00pm</span></td></tr><tr><td class=\"highlight-grey\" colspan=\"1\" data-highlight-colour=\"grey\">&nbsp;</td><td class=\"highlight-grey\" colspan=\"1\" data-highlight-colour=\"grey\">&nbsp;</td><td class=\"highlight-grey\" colspan=\"1\" data-highlight-colour=\"grey\">&nbsp;</td></tr><tr><td colspan=\"1\">fs-web</td><td colspan=\"1\">2.0.11</td><td colspan=\"1\">2016/06/22 12:30pm</td></tr><tr><td>fs-ui</td><td>1.0.0-SNAPSHOT</td><td>&nbsp;</td></tr><tr><td colspan=\"1\">fs-swagger-ui</td><td colspan=\"1\">0.0.2</td><td colspan=\"1\">2016/03/08 4:56pm</td></tr></tbody> """# let stringRange = NSRange(location: 0, length: testString.utf16.count) if let firstMatch = regex.firstMatch(in: testString, range: stringRange) { let result: [String] = (1 ..< firstMatch.numberOfRanges).map { (testString as NSString).substring(with: firstMatch.range(at: $0)) } print(result) } else { print("No matches were found.") }

Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Swift 5.2, please visit: https://developer.apple.com/documentation/foundation/nsregularexpression