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
    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
    BonMot is a Swift attributed string library

    BonMot (pronounced Bon Mo, French for good word) is a Swift attributed string library. It abstracts away the complexities of the iOS, macOS, tvOS, and

    Rightpoint 3.4k Dec 30, 2022
    Croc is a swift emoji string parsing library

    Croc is a library for parsing emojis on iOS. It provides a simple and lightweight interface for detecting, generating, categorizing and managing emoji characters, making emoji-powered features an easy task for developers.

    Joe Kalash 127 Nov 20, 2022
    Fully open source text editor for iOS written in Swift.

    Edhita Fully open source text editor for iOS written in Swift. http://edhita.bornneet.com/ What Edhita means? Edhita (Romaji) == エディタ (Katakana) == Ed

    Tatsuya Tobioka 1.2k Jan 1, 2023
    A simple and customizable Markdown Parser for Swift

    MarkdownKit MarkdownKit is a customizable and extensible Markdown parser for iOS and macOS. It supports many of the standard Markdown elements through

    Bruno Oliveira 687 Dec 18, 2022
    Marky Mark is a parser written in Swift that converts markdown into native views.

    Marky Mark is a parser written in Swift that converts markdown into native views. The way it looks it highly customizable and the supported markdown syntax is easy to extend.

    M2mobi 287 Nov 29, 2022
    Swift Parser Combinators

    Parsey Swift Parser Combinator Framework In addition to simple combinators, Parsey supports source location/range tracking, backtracking prevention, a

    Richard Wei 56 Jun 30, 2022
    Great Swift String Pluralize Extension

    Pluralize.swift Great Swift String Pluralize Extension case-insensitive tons of rules for irregular nouns (plural form) supports uncountable nouns all

    Joshua Arvin Lat 193 Nov 8, 2022
    An NSPredicate DSL for iOS, OSX, tvOS, & watchOS. Inspired by SnapKit and lovingly written in Swift.

    PrediKit A Swift NSPredicate DSL for iOS & OS X inspired by SnapKit, lovingly written in Swift, and created by that weird dude at KrakenDev. If you're

    Hector Matos 542 Sep 24, 2022
    PySwiftyRegex - Easily deal with Regex in Swift in a Pythonic way

    PySwiftyRegex Easily deal with Regex in Swift in a Pythonic way.

    Ce Zheng 232 Oct 12, 2022
    πŸ‘©β€πŸŽ¨ Elegant Attributed String composition in Swift sauce

    Elegant Attributed String composition in Swift sauce SwiftRichString is a lightweight library which allows to create and manipulate attributed strings

    Daniele Margutti 2.9k Jan 5, 2023
    A Swift framework for parsing, formatting and validating international phone numbers. Inspired by Google's libphonenumber.

    PhoneNumberKit Swift 5.3 framework for parsing, formatting and validating international phone numbers. Inspired by Google's libphonenumber. Features F

    Roy Marmelstein 4.7k Jan 8, 2023
    A comprehensive, lightweight string extension for Swift

    SwiftString SwiftString is a lightweight string extension for Swift. This library was motivated by having to search StackOverflow for common string op

    Andrew Mayne 1.6k Dec 30, 2022
    A Swift Formatter Kit

    Format A Swift formatter kit. Simple formatting syntax for decimal numbers, currency, mass, addresses, ordinal numbers and hexadecimal colors. Usage I

    Roy Marmelstein 1.2k Nov 8, 2022
    🌭 Mustard is a Swift library for tokenizing strings when splitting by whitespace doesn't cut it.

    Mustard ?? Mustard is a Swift library for tokenizing strings when splitting by whitespace doesn't cut it. Quick start using character sets Foundation

    Mathew Sanders 695 Nov 11, 2022
    Automatic summarizer text in Swift

    Overview Reductio is a tool used to extract keywords and phrases using an implementation of the algorithm TextRank. Installation Swift Package Manager

    Sergio FernΓ‘ndez 438 Dec 9, 2022
    OysterKit is a framework that provides a native Swift scanning, lexical analysis, and parsing capabilities. In addition it provides a language that can be used to rapidly define the rules used by OysterKit called STLR

    OysterKit A Swift Framework for Tokenizing, Parsing, and Interpreting Languages OysterKit enables native Swift scanning, lexical analysis, and parsing

    Swift Studies 178 Sep 16, 2022
    Swift markdown library

    Markdown ![Swift version](https://img.shields.io/badge/Swift-2.1 | 2.2-blue.svg) ![GitHub license](https://img.shields.io/badge/license-LGPL v3-green.

    Crossroad Labs 79 Oct 9, 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