GithubHelp home page GithubHelp logo

Regular expression support about dollar HOT 10 CLOSED

ankurp avatar ankurp commented on July 20, 2024
Regular expression support

from dollar.

Comments (10)

ankurp avatar ankurp commented on July 20, 2024

Thanks! Yes it makes sense to add helper methods for regex or even creating extensions for NSRegularExpression in the Cent library if it makes sense. Let me know if you need help implementing.

from dollar.

coryroloff avatar coryroloff commented on July 20, 2024

How do you determine which APIs should be in Dollar and which should be extensions in Cent?

We could do something for regular expressions like:

$.test("^some sort of regex$", "data to test against") -> true/false

or this maybe? "data to test against".match("^some sort of regex$")

Each API could accept both a string and an NSRegularExpression object. Thoughts?

from dollar.

nubbel avatar nubbel commented on July 20, 2024

I have created a Swift port of VerbalExpressions: https://github.com/VerbalExpressions/SwiftVerbalExpressions
Would that be something for you or is it too much sugar?

from dollar.

coryroloff avatar coryroloff commented on July 20, 2024

VertbalExpressions looks really good, nubbel; I'll try it out. I think having basic regular expression support in Dollar is still valuable though.

from dollar.

ankurp avatar ankurp commented on July 20, 2024

I would make a functional method in Dollar and have the String class extension implement a match method using the functional implementation imported from Dollar

from dollar.

ankurp avatar ankurp commented on July 20, 2024

Made any progress with this or need some help?

from dollar.

coryroloff avatar coryroloff commented on July 20, 2024

Hey ankurp, sorry, I haven't had much time. I'll try to get you a pull request tomorrow. :) Sorry for the wait.

from dollar.

ankurp avatar ankurp commented on July 20, 2024

@coryroloff No problem. Let me know if you run into any issues running tests as currently I am not able to get the test to run due to Swift and SourceKit hogging all of the CPU and memory in Xcode Beta5

from dollar.

coryroloff avatar coryroloff commented on July 20, 2024

I run into the same issue, but I commented out the other tests for now. Unfortunately, Beta5 is throwing an exception with the NSRegularExpression class, which Beta4 had no trouble with.

Even just running this example of using NSRegularExpression causes the runtime to fail. It throws an exception on the "regex.matchesInString" method (and the other match methods as well) with the error:

dyld: lazy symbol binding failed: Symbol not found: _objc_readClassPair

Have you run into this issue before?


var error: NSError?

let string = "data to match"
let regex = NSRegularExpression(pattern: ".*", options: nil, error: &error)

assert(error == nil)

var matches = regex.matchesInString(string, options: nil, range: NSMakeRange(0, countElements(string)))

from dollar.

ankurp avatar ankurp commented on July 20, 2024

Done

from dollar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.