Regular expressions for swift

Overview

by Crossroad Labs

Regex

🐧 linux: ready GitHub license Build Status GitHub release Carthage compatible CocoaPods version Platform OS X | iOS | tvOS | watchOS | Linux

Advanced regular expressions for Swift

Goals

Regex library was mainly introduced to fulfill the needs of Swift Express - web application server side framework for Swift.

Still we hope it will be useful for everybody else.

Happy regexing ;)

Features

  • Deep Integration with Swift
    • =~ operator support
    • Swift Pattern Matching (aka switch operator) support
  • Named groups
  • Match checking
  • Extraction/Search functions
  • Replace functions
    • With a pattern
    • With custom replacing function
  • Splitting with a Regular Expression
    • Simple
    • With groups
  • String extensions
  • Supports grapheme clusters 👨‍👩‍👧

Extra

Path to Regex converter is available as a separate library here: PathToRegex

This one allows using path patterns like /folder/*/:file.txt or /route/:one/:two to be converted to Regular Expressions and matched against strings.

Getting started

Installation

Package Manager

Add the following dependency to your Package.swift:

.Package(url: "https://github.com/crossroadlabs/Regex.git", majorVersion: 1)

Run swift build and build your app.

CocoaPods

Add the following to your Podfile:

pod 'CrossroadRegex'

Make sure that you are integrating your dependencies using frameworks: add use_frameworks! to your Podfile. Then run pod install.

Carthage

Add the following to your Cartfile:

github "crossroadlabs/Regex"

Run carthage update and follow the steps as described in Carthage's README.

Manually

  1. Download and drop /Regex folder in your project.
  2. Congratulations!

Examples

Hello Regex:

All the lines below are identical and represent simple matching. All operators and matches function return Bool

//operator way, can match either regex or string containing pattern
"l321321alala" =~ "(.+?)([123]*)(.*)".r
"l321321alala" =~ "(.+?)([123]*)(.*)"

//similar function
"(.+?)([123]*)(.*)".r!.matches("l321321alala")

Operator !~ returns true if expression does NOT match:

"l321321alala" !~ "(.+?)([123]*)(.*)".r
"l321321alala" !~ "(.+?)([123]*)(.*)"
//both return false

Swift Pattern Matching (aka switch keyword)

Regex provides very deep integration with Swift and can be used with the switch keyword in the following way:

let letter = "a"
let digit = "1"
let other = "!"

//you just put your string is a regular Swift's switch to match to regular expressions
switch letter {
	//note .r after the string literal of the pattern
	case "\\d".r: print("digit")
	case "[a-z]".r: print("letter")
	default: print("bizarre symbol")
}

switch digit {
	case "\\d".r: print("digit")
	case "[a-z]".r: print("letter")
	default: print("bizarre symbol")
}

switch other {
	//note .r after the string literal of the pattern
	case "\\d".r: print("digit")
	case "[a-z]".r: print("letter")
	default: print("bizarre symbol")
}

The output of the code above will be:

letter
digit
bizarre symbol

Accessing groups:

// strings can be converted to regex in Scala style .r property of a string
let digits = "(.+?)([123]*)(.*)".r?.findFirst(in: "l321321alala")?.group(at: 2)
// digits is "321321" here

Named groups:

let regex:RegexType = try Regex(pattern:"(.+?)([123]*)(.*)",
                                        groupNames:"letter", "digits", "rest")
let match = regex.findFirst(in: "l321321alala")
if let match = match {
	let letter = match.group(named: "letter")
	let digits = match.group(named: "digits")
	let rest = match.group(named: "rest")
	//do something with extracted data
}

Replace:

let replaced = "(.+?)([123]*)(.*)".r?.replaceAll(in: "l321321alala", with: "$1-$2-$3")
//replaced is "l-321321-alala"

Replace with custom replacer function:

let replaced = "(.+?)([123]+)(.+?)".r?.replaceAll(in: "l321321la321a") { match in
	if match.group(at: 1) == "l" {
		return nil
	} else {
		return match.matched.uppercaseString
	}
}
//replaced is "l321321lA321A"

Split:

In the following example, split() looks for 0 or more spaces followed by a semicolon followed by 0 or more spaces and, when found, removes the spaces from the string. nameList is the array returned as a result of split().

let names = "Harry Trump ;Fred Barney; Helen Rigby ; Bill Abel ;Chris Hand"
let nameList = names.split(using: "\\s*;\\s*".r)
//name list contains ["Harry Trump", "Fred Barney", "Helen Rigby", "Bill Abel", "Chris Hand"]

Split with groups:

If separator contains capturing parentheses, matched results are returned in the array.

let myString = "Hello 1 word. Sentence number 2."
let splits = myString.split(using: "(\\d)".r)
//splits contains ["Hello ", "1", " word. Sentence number ", "2", "."]

Changelog

You can view the CHANGELOG as a separate document here.

Contributing

To get started, sign the Contributor License Agreement.

Crossroad Labs by Crossroad Labs

Comments
  • Swift 5

    Swift 5

    Updated targets for Swift 5 and bumped the swift versions where applicable.

    I've set up Travis to run on the branch so hopefully the changes in .travis.yml work.

    opened by finestructure 8
  • Version Bump

    Version Bump

    Looks like you forgot to run pod trunk push on the version bump, it's not showing up:

    $ pod trunk info CrossroadRegex
    
    CrossroadRegex
        - Versions:
          - 0.3 (2016-01-24 23:51:25 UTC)
          - 0.4 (2016-01-25 16:37:05 UTC)
          - 0.4.1 (2016-02-09 17:47:28 UTC)
          - 0.5 (2016-02-18 10:30:15 UTC)
          - 0.5.2 (2016-02-18 11:32:27 UTC)
          - 0.6.0 (2016-04-06 11:29:12 UTC)
          - 0.7.0 (2016-06-18 19:31:02 UTC)
          - 0.8.0 (2016-07-28 18:40:03 UTC)
          - 1.0.0 (2017-04-15 13:47:51 UTC)
          - 1.0.0-alpha.1 (2016-11-04 18:51:05 UTC)
        - Owners:
          - Daniel Leping <[email protected]>
    
    opened by Coder-256 6
  • That's not how regex is

    That's not how regex is

    Your README is full of examples of [1,2,3], but character classes do not use commas. So either you really want to match commas, or your README needs to be remedied. :smiley:

    (should be just [123])

    opened by colinta 5
  • Fails to build under Carthage and Xcode 8.1

    Fails to build under Carthage and Xcode 8.1

    My Cartfile:

    github "crossroadlabs/Regex" == 0.8.0
    

    Build results:

    $ carthage update
    *** Fetching Regex
    *** Fetching Boilerplate
    *** Fetching Result
    *** Checking out Result at "2.0.1"
    *** Checking out Boilerplate at "0.2.4"
    *** Checking out Regex at "0.8.0"
    *** xcodebuild output can be found in /var/folders/16/jfb809_s2fz01ql7k494f6pc0000gn/T/carthage-xcodebuild.lQCr2C.log
    *** Building scheme "Result-watchOS" in Result.xcodeproj
    2016-11-20 21:11:41.507 xcodebuild[17389:36782835] [MT] PluginLoading: Required plug-in compatibility UUID DA4FDFD8-C509-4D8B-8B55-84A7B66AE701 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/SparkInspectorXcodePlugin.xcplugin' not present in DVTPlugInCompatibilityUUIDs
    2016-11-20 21:11:41.507 xcodebuild[17389:36782835] [MT] PluginLoading: Required plug-in compatibility UUID DA4FDFD8-C509-4D8B-8B55-84A7B66AE701 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/ClangFormat.xcplugin' not present in DVTPlugInCompatibilityUUIDs
    2016-11-20 21:11:41.970 xcodebuild[17389:36782835] [MT] IDEProvisioning: Migrating '<Xcode3Target:0x7fb539196710:Result-watchOS>' to use provisioning style
    2016-11-20 21:11:41.970 xcodebuild[17389:36782835] [MT] IDEProvisioning: Configuration 'Debug' for target '<Xcode3Target:0x7fb539196710:Result-watchOS>' is automatic
    2016-11-20 21:11:41.970 xcodebuild[17389:36782835] [MT] IDEProvisioning: Configuration 'Release' for target '<Xcode3Target:0x7fb539196710:Result-watchOS>' is automatic
    ** CLEAN FAILED **
    
    
    The following build commands failed:
    	Check dependencies
    (1 failure)
    ** BUILD FAILED **
    
    
    The following build commands failed:
    	Check dependencies
    (1 failure)
    A shell task (/usr/bin/xcrun xcodebuild -project /Users/MyProj/Carthage/Checkouts/Result/Result.xcodeproj -scheme Result-watchOS -configuration Release -sdk watchos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build) failed with exit code 65:
    2016-11-20 21:11:41.507 xcodebuild[17389:36782835] [MT] PluginLoading: Required plug-in compatibility UUID DA4FDFD8-C509-4D8B-8B55-84A7B66AE701 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/SparkInspectorXcodePlugin.xcplugin' not present in DVTPlugInCompatibilityUUIDs
    2016-11-20 21:11:41.507 xcodebuild[17389:36782835] [MT] PluginLoading: Required plug-in compatibility UUID DA4FDFD8-C509-4D8B-8B55-84A7B66AE701 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/ClangFormat.xcplugin' not present in DVTPlugInCompatibilityUUIDs
    2016-11-20 21:11:41.970 xcodebuild[17389:36782835] [MT] IDEProvisioning: Migrating '<Xcode3Target:0x7fb539196710:Result-watchOS>' to use provisioning style
    2016-11-20 21:11:41.970 xcodebuild[17389:36782835] [MT] IDEProvisioning: Configuration 'Debug' for target '<Xcode3Target:0x7fb539196710:Result-watchOS>' is automatic
    2016-11-20 21:11:41.970 xcodebuild[17389:36782835] [MT] IDEProvisioning: Configuration 'Release' for target '<Xcode3Target:0x7fb539196710:Result-watchOS>' is automatic
    ** CLEAN FAILED **
    
    
    The following build commands failed:
    	Check dependencies
    (1 failure)
    ** BUILD FAILED **
    
    
    The following build commands failed:
    	Check dependencies
    (1 failure)
    
    opened by JetForMe 4
  • RegEx not matched due to extended Unicode characters

    RegEx not matched due to extended Unicode characters

    When a string contains extended Unicode characters (like emojis), RegEx are not applied to its entirety. This is usually unnoticed but when you try to match something at the very end of a string containing emojis, you can spend hours trying to find an issue in your RegExâ€Ļ

    This is probably linked to the NSString/String mapping used for Swift RegEx functions, explained here: https://stackoverflow.com/questions/29756530/swift-regex-matching-fails-when-source-contains-unicode-characters

    Replacing the few occurrences of

        let range = GroupRange(location: 0, length: source.characters.count)
    

    by

        let range = GroupRange(location: 0, length: (source as NSString).length)
    

    seems to make everything working fine.

    opened by kapfab 2
  • Error on swift build

    Error on swift build

    Hello; I've got this error on both Mac OS X and Linux when trying to use crossroadlabs/Regex:

    error: the module at Tests/Result has an invalid name ('Result'): the name of a test module has no ‘Tests’ suffix fix: rename the module at ‘Tests/Result’ to have a ‘Tests’ suffix

    opened by frranck 2
  • Swift 4 - 'Value of optional type 'String?' not unwrapped; did you mean to use '!' or '?'?'

    Swift 4 - 'Value of optional type 'String?' not unwrapped; did you mean to use '!' or '?'?'

    Im using your lib with the version1.1.0`

    I got this error message for the file Regex.swift.

    The following is the affected line:

    361: result.append(piece)

    opened by ItsMeSandu 1
  • Swift 4 - 'range(at:)' has been renamed to 'rangeAt(_:)'

    Swift 4 - 'range(at:)' has been renamed to 'rangeAt(_:)'

    I'm using your lib with the version 1.1.0

    I got this error message for the file Match.swift.

    The following are the affected lines: 117: let stringRange = try? match.range(at: i).asRange(ofString: source) 133: return try? match.range(at: index).asRange(ofString: source) 145: return try? match.range(at: groupIndex).asRange(ofString: source)

    opened by ItsMeSandu 1
  • Error in dependencies

    Error in dependencies

    When I try importing Regex with the following dependency in my project, I'm getting different contents for the Package.swift file:

    //In my own Package.swift file
        ...
        .Package(url: "https://github.com/crossroadlabs/Regex.git", majorVersion: 0),
        ...
    

    Contents of the Regex/Package.swift I'm getting:

    import PackageDescription
    
    let package = Package(
        name: "Regex",
        targets: [Target(name: "Regex")],
        dependencies: [.Package(url: "https://github.com/crossroadlabs/Boilerplate.git", majorVersion: 0, minor: 2)]
    )
    

    Instead of

    import PackageDescription
    
    let package = Package(
        name: "Regex",
        targets: [Target(name: "Regex")],
        dependencies: [.Package(url: "https://github.com/crossroadlabs/Boilerplate.git", Version(1, 0, 0, prereleaseIdentifiers: ["alpha", "1"]))],
        exclude: ["Carthage"]
    )
    

    What's odd is that SPM is resolving Regex 0.8.0 but with different contents than this repo. The issue is that Boilerplate depends on Result and they have both been updated to support Swift 3, but the version of Regex I'm getting is relying on a deprecated version of Boilerplate.

    opened by califrench 1
  • Manual Installation

    Manual Installation

    CocoaPods and Carthage are awesome tools and make our life really easier, but there are some devs who still don't know how to use them.

    It would be cool to add the Manual installation guide in your README.md. You can take a look at my iOS Readme Template to see how you can do it.

    opened by lfarah 0
  • =~ and !~ don't work

    =~ and !~ don't work

    I installed library with the latest cocoapods

    target 'CardSampleTestTask' do
      # Comment the next line if you don't want to use dynamic frameworks
      use_frameworks!
    
      # Pods for CardSampleTestTask
      pod 'CrossroadRegex'
    
      target 'CardSampleTestTaskTests' do
        inherit! :search_paths
        # Pods for testing
      end
    
      target 'CardSampleTestTaskUITests' do
        # Pods for testing
      end
    
    end
    

    Opened the project as a workspace and I have an error Cannot find operator '!~' in scope

    opened by EduardStreltsov 0
  • Feature Request: Support in-pattern named groups

    Feature Request: Support in-pattern named groups

    I'd love to have this support the same named groups that NSRE supports, like this:

    // NSRegularExpression
    try! NSRegularExpression(pattern:
            "^(?<major>\\d+)\\." +
            "(?<minor>\\d+)\\." +
            "(?<patch>\\d+)" +
            "(?:-(?<preRelease>(?:(?<preReleaseId>[0-9A-Za-z-]+)\\.?)+))?" +
            "(?:\\+(?<build>(?:(?<buildId>[0-9A-Za-z-]+)\\.?)+))?$",
            options: [])
    
    // Crossroad Labs Regex
    try! Regex(pattern:
            "^(?<major>\\d+)\\." +
            "(?<minor>\\d+)\\." +
            "(?<patch>\\d+)" +
            "(?:-(?<preRelease>(?:(?<preReleaseId>[0-9A-Za-z-]+)\\.?)+))?" +
            "(?:\\+(?<build>(?:(?<buildId>[0-9A-Za-z-]+)\\.?)+))?$",
            groupNames: "major", "minor", "patch", "preRelease", "preReleaseId", "build", "buildId")
    

    This feels fragile to me; I feel like it might easily slip so that one group's name doesn't represent the intended group, and that might be subtle enough to not catch in testing.

    It's also silly because it accepts the same syntax for in-pattern group names that NSRegularExpression accepts, without using it.

    opened by KyLeggiero 0
  • Regular expression not working (all characters are shifted)

    Regular expression not working (all characters are shifted)

    Hi there,

    I am using a regular expression to look for the url of the 'visually similar' button on google. This is the regex I use: "href=((?:(?!href).)*?)>Vis"

    and it works perfectly when testing on https://regexr.com/ this is some example to-match text:


    enu-panel" role="menu" tabindex="-1" jsaction="keydown:Xiq7wd;mouseover:pKPowd;mouseout:O9bKS" data-ved="2ahUKEwjRitfP9vXvAhXf_7sIHViuBewQqR8wAXoECAMQBQ"><li class="action-menu-item" role="menuitem"><a class="fl" href="https://webcache.googleusercontent.com/search?q=cache:8lDNWm_duSMJ:https://www.trustedshops.com/+&cd=2&hl=en&ct=clnk&gl=de" ping="/url?sa=t&source=web&rct=j&url=https://webcache.googleusercontent.com/search%3Fq%3Dcache:8lDNWm_duSMJ:https://www.trustedshops.com/%2B%26cd%3D2%26hl%3Den%26ct%3Dclnk%26gl%3Dde&ved=2ahUKEwjRitfP9vXvAhXf_7sIHViuBewQIDABegQIAxAG">Cached

<div class="IsZvec"><span class="aCOpRe">Trusted Shops is the European Trustmark for online shops with money-back guarantee for consumers. Trusted Shops offers a comprehensive service to raise ...
<div class="ULSxyf"><div jsmodel="gpo5Gf" class="LnbJhc" data-count="28" style="position:relative" data-iu="1" data-hveid="CAIQAA" data-ved="2ahUKEwjRitfP9vXvAhXf_7sIHViuBewQ8w0oAHoECAIQAA"><div class="e2BEnf U7izfe mfMhoc"><a class="ekf0x hSQtef" href="/search?tbs=simg:CAESiQIJQs8eCt9yzs0a_1QELELCMpwgaOgo4CAQSFNcy_1TP2GfwQ9zXEDcYqnTbjEq4kGhqVVToFJUcTvzott-6Sl5Qp4R6jBL5G5bKsuyAFMAQMCxCOrv4IGgoKCAgBEgTTC8hDDAsQne3BCRqdAQofCgxvZmZpY2UgY2hhaXLapYj2AwsKCS9tLzA4cTF4cAofCgxzd2l2ZWwgY2hhaXLapYj2AwsKCS9tLzBncTZreAoiCg9mdXJuaXR1cmUgc3R5bGXapYj2AwsKCS9qLzl3MHFqcwobCghmb3IgdGVlbtqliPYDCwoJL2EvNnEzMDY3ChgKBXNvbGlk2qWI9gMLCgkvYS8zbWcxY20M&q=trusted+shop&tbm=isch&sa=X&ved=2ahUKEwjRitfP9vXvAhXf_7sIHViuBewQjJkEegQIAhAB"><div class="iv236"><span class="iJddsb" style="height:20px;width:20px"><svg focusable="false" viewbox="0 0 24 24"><path d="M14 13l4 5H6l4-4 1.79 1.78L14 13zm-6.01-2.99A2 2 0 0 0 8 6a2 2 0 0 0-.01 4.01zM22 5v14a3 3 0 0 1-3 2.99H5c-1.64 0-3-1.36-3-3V5c0-1.64 1.36-3 3-3h14c1.65 0 3 1.36 3 3zm-2.01 0a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h7v-.01h7a1 1 0 0 0 1-1V5"><div class="iJ1Kvb"><h3 class="GmE3X" aria-level="2" role="heading">Visually similar images<div style="padding-bottom:0" id="iur">
<div jsmodel="" jscontroller="IkchZc" jsaction="PdWSXe:h5M12e;rcuQ6b:npT2md" jsdata="X2sNs;;CiOOHU"><div data-h="130" data-nr="4" style="margin-right:-2px;margin-bottom:-2px"><div jsname="dTDiAc" class="eA0Zlc qN5nNb tapJqb ivg-i" data-docid="DrX4TNBpITAGoM" jsdata="XZxcdf;DrX4TNBpITAGoM;CiOOJI" data-ved="2ahUKEwjRitfP9vXvAhXf_7sIHViuBewQ5r0BegQIIRAA"><a href="/search?q=trusted+shop&tbm=isch&source=iu&ictx=1&tbs=simg:CAESiQIJQs8eCt9yzs0a_1QELELCMpwgaOgo4CAQSFNcy_1TP2GfwQ9zXEDcYqnTbjEq4kGhqVVToFJUcTvzott-6Sl5Qp4R6jBL5G5bKsuyAFMAQMCxCOrv4IGgoKCAgBEgTTC8hDDAsQne3BCRqdAQofCgxvZmZpY2UgY2hhaXLapYj2AwsKCS9tLzA4cTF4cAofCgxzd2l2ZWwgY2hhaXLapYj2AwsKCS9tLzBncTZreAoiCg9mdXJuaXR1cmUgc3R5bGXapYj2AwsKCS9qLzl3MHFqcwobCghmb3IgdGVlbtqliPYDCwoJL2EvNnEzMDY3ChgKBXNvbGlk2qWI9gMLCgkvYS8zbWcxY20M&fir=DrX4TNBpITAGoM%252CO1KPcBx95JlNxM%252C&vet=1&usg=AI4_-


When using this exact same regex with your swift Regex expression I do not get the expected result, but I get the following:


FNcy_1TP2GfwQ9zXEDcYqnTbjEq4kGhqVVToFJUcTvzott-6Sl5Qp4R6jBL5G5bKsuyAFMAQMCxCOrv4IGgoKCAgBEgTTC8hDDAsQne3BCRqdAQofCgxvZmZpY2UgY2hhaXLapYj2AwsKCS9tLzA4cTF4cAofCgxzd2l2ZWwgY2hhaXLapYj2AwsKCS9tLzBncTZreAoiCg9mdXJuaXR1cmUgc3R5bGXapYj2AwsKCS9qLzl3MHFqcwobCghmb3IgdGVlbtqliPYDCwoJL2EvNnEzMDY3ChgKBXNvbGlk2qWI9gMLCgkvYS8zbWcxY20M&q=trusted+shop&tbm=isch&sa=X&ved=2ahUKEwjRitfP9vXvAhXf_7sIHViuBewQjJkEegQIAhAB"><div class="iv236"><span class="iJddsb" style="height:20px;width:20px"><svg focusable="false" viewbox="0 0 24 24"><path d="M14 13l4 5H6l4-4 1.79 1.78L14 13zm-6.01-2.99A2 2 0 0 0 8 6a2 2 0 0 0-.01 4.01zM22 5v14a3 3 0 0 1-3 2.99H5c-1.64 0-3-1.36-3-3V5c0-1.64 1.36-3 3-3h14c1.65 0 3 1.36 3 3zm-2.01 0a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h7v-.01h7a1 1 0 0 0 1-1V5">

<div class="iJ1Kvb"><h3 class="GmE3X" aria-level="2" role="heading">Visually similar images<div s


As you can see it somehow captures beyond the last capture group ">Vis". And additionally there are a lot of characters missing from the start of the expected capture.. all the characters next to the "href=".

I tried a lot to rewrite my regex, but as it is confirmed to be working on regex testers I must conclude that there is something wrong with this Regex cocoapod.

Please help! Thank you A link to the regex helper tool: regexr.com/5qfv4

opened by dataexcess 0
  • Strings containing emojis produce shifted results

    Strings containing emojis produce shifted results

    I seems that when emojis are present it shifts the resulting groups and matched strings.

    For example I was using

    let textRegex = "\\[([^]]*)\\]".r!
    
    let input = """
    Mexican culture has lots of rich history and great food! đŸŒ¯đŸŒ¯đŸŒ¯đŸŒ¯
    
    Avacado's are already incredibly popular and for good reason: They taste good, work in tons or recipes, and are [good for you]<url>{https://www.healthline.com/nutrition/12-proven-benefits-of-avocado}. So maybe you already have [avocado]<trend>{avocado-intake} every day or maybe just every once in a while, but maybe there's even more reasons to love these green fatty fruits! [Avacado's have been shown to improve sleep]<url>{https://www.cbsnews.com/pictures/foods-that-will-help-you-sleep-better/9/}.
    """
    
    for text in textRegex.findAll(in: input).makeIterator(){
        print(text.matched)
    }
    

    This produces: d for you]<url cado]<tre cado's have been shown to improve sleep]<url

    Instead of the expected: good for you avocado Avacado's have been shown to improve sleep

    The shifting is caused by the presence of the emoji. Each emoji shifts the results index by 1, so here its shifted by 4.

    opened by david-gorski 0
  • Can not build swift package

    Can not build swift package

    Can not build lib using swift package manager.

    Swift version: 3.1 Log:

    error: invalid target name at 'Tests/Regex'; name of test targets must end in 'Tests' error: invalid target name at 'Tests/Boilerplate'; name of test targets must end in 'Tests' error: invalid target name at 'Tests/Result'; name of test targets must end in 'Tests'

    opened by denis631 1
  • Releases(1.2.0)
    Owner
    Crossroad Labs
    Crossroad Labs s.r.o.
    Crossroad Labs
    Perl-like regex =~ operator for Swift

    SwiftRegex Perl-like regex =~ operator for Swift This package implements a =~ string infix operator for use in testing regular expressions and retriev

    Gregory Todd Williams 112 Oct 15, 2022
    Easily deal with Regex in Swift in a Pythonic way

    PySwiftyRegex Easily deal with Regex in Swift in a Pythonic way. įŽ€äŊ“中文 æ—ĨæœŦčĒž 한ęĩ­ė–´ This is Easy import PySwiftyRegex if let m = re.search("[Tt]his is (.*?

    Ce Zheng 232 Oct 12, 2022
    Regex class for Swift. Wraps NSRegularExpression.

    Regex.swift install Use CocoaPods. Add to your Podfile: pod 'Regex' And then run pod install from the shell: $ pod install usage Simple use cases: Str

    Bryn Bellomy 67 Sep 14, 2022
    This is a repo for my implementation of Gang of Four Book: Software Design Patterns. All written in Swift.

    GoF-Swift-Design-Patterns This repo is intended to implement the known Software Design Patterns from the Gang of Four book using Swift Programming Lan

    Noor El-Din Walid 3 Jul 11, 2022
    XRepository: lightweight implementation of Repository pattern in Swift

    XRepository is based on QBRepository by QuickBirds Studios. It is lightweight im

    Sashko Potapov 2 Jan 10, 2022
    Specification pattern implemented in swift (iOS/OSX)

    SpecificationPattern The Specification design pattern implemented in swift for iOS/OSX. In computer programming, the specification pattern is a partic

    Simon Strandgaard 46 Sep 21, 2022
    Learn about how SoulverCore can give Swift "better than regex" data parsing features (for many common tasks)

    String Parsing with Soulver Core A declarative & type-safe approach to parsing data from strings SoulverCore gives you human-friendly, type-safe & per

    Soulver 140 Nov 23, 2022
    Regular expressions for swift

    Regex Advanced regular expressions for Swift Goals Regex library was mainly introduced to fulfill the needs of Swift Express - web application server

    Crossroad Labs 328 Nov 20, 2022
    SwiftVerbalExpressions is a Swift library that helps to construct difficult regular expressions

    SwiftVerbalExpressions Swift Regular Expressions made easy SwiftVerbalExpressions is a Swift library that helps to construct difficult regular express

    null 582 Jun 29, 2022
    Regular expressions for swift

    Regex Advanced regular expressions for Swift Goals Regex library was mainly introduced to fulfill the needs of Swift Express - web application server

    Crossroad Labs 328 Nov 20, 2022
    Swifty regular expressions

    Regex Swifty regular expressions This is a wrapper for NSRegularExpression that makes it more convenient and type-safe to use regular expressions in S

    Sindre Sorhus 311 Nov 22, 2022
    Kukai Crypto Swift is a native Swift library for creating regular or HD wallets for the Tezos blockchain

    Kukai Crypto Swift Kukai Crypto Swift is a native Swift library for creating regular and HD key pairs for the Tezos blockchain. Supporting both TZ1 (E

    Kukai Wallet 2 Aug 18, 2022
    A delightful and expressive regular expression type for Swift.

    Regex Pattern match like a boss. Usage Create: // Use `Regex.init(_:)` to build a regex from a static pattern let greeting = Regex("hello (world|univ

    Adam Sharp 612 Dec 17, 2022
    A Cross-Platform String and Regular Expression Library written in Swift.

    Guitar ?? A Cross-Platform String and Regular Expression Library written in Swift. About This library seeks to add common string manipulation function

    Arthur Ariel Sabintsev 659 Dec 27, 2022
    A cross-platform Swift library for evaluating mathematical expressions at runtime

    Introduction What? Why? How? Usage Installation Integration Symbols Variables Operators Functions Arrays Performance Caching Optimization Standard Lib

    Nick Lockwood 738 Jan 7, 2023
    Eval for Swift - Easily evaluate simple expressions on the go

    Eval for Swift Easily evaluate simple expressions on the go... This is a port of the BigEval.js/Eval.net library Features: Evaluate basic math operato

    Daniel Cohen Gindi 2 Mar 9, 2022
    A charmful decade with many colors patterns, disco music, and other cultural expressions that we refer to as vintage

    MontyHallProblem Welcome to the 70s! ?? That is a charmful decade with many colors patterns, disco music, and other cultural expressions that we refer

    Diogo Infante 2 Dec 28, 2021
    Îŧ-library enabling if/else and switch statements to be used as expressions.

    swift-expression Many languages such as Scala, Rust and Kotlin support using if/else and switch statements as expressions – meaning that they can by t

    Nikita Mounier 1 Nov 8, 2021
    A fast, pure swift MongoDB driver based on Swift NIO built for Server Side Swift

    A fast, pure swift MongoDB driver based on Swift NIO built for Server Side Swift. It features a great API and a battle-tested core. Supporting both MongoDB in server and embedded environments.

    null 646 Dec 10, 2022
    Swift-music - swift-music is a swift package that provides an easy-to-use API for music related developments.

    ?? swift-music Introduction swift-music is a swift package that provides an easy-to-use API for music related developments. Currently available module

    Jin Zhang 4 Feb 8, 2022