Giter VIP home page Giter VIP logo

Comments (6)

fayeed avatar fayeed commented on September 21, 2024 2

My bad so it not so much about the regex as it is about how the library works so it splits the string by space and then performs regex validation on the individual word so in your case +1 (800) 831-1117 this gets split into 3 parts +1 (800) 831-1117 hence the phone regex doesn't work and also it doesn't split at \n so that doesn't work either.

I have changed a few things in the package and it should work now, do update it to version 1.2.0

Here's the text that I parsed:

"[@michael:51515151] Hello this is an example of the ParsedText, links like http://www.google.com or http://www.facebook.com are clickable and phone number 444-555-6666 can call too. But you can also do more with this package, for example, Bob will change style and David too.\nAlso a US number example +1-(800)-831-1117. [email protected] And the magic number is 42! #flutter #flutterdev"

Webp net-resizeimage

from flutter_parsed_text.

fayeed avatar fayeed commented on September 21, 2024 1

ok, I think this regex would work great ^\s*(?:\+?(\d{1,3}))?[-. (]*(\d{3})[-. )]*(\d{3})[-. ]*(\d{4})(?: *x(\d+))?\s*$

https://stackoverflow.com/a/16702965/6709477

from flutter_parsed_text.

fayeed avatar fayeed commented on September 21, 2024

@erickjtorres can you give an example of what you are doing because it works fine for most of the phone number format that I tried.

from flutter_parsed_text.

erickjtorres avatar erickjtorres commented on September 21, 2024

Currently at work we have data that is returned in the following format

This app is offered by [Company]\n302, Woodcliff Lake, New Jersey 02277-7731\nAttn: Customer Relations, Services.\n\nContact:\[email protected]\n+1 (800) 831-1117

The +1 gets cut off from the regular expression. This could be because of how currently the text is split into spaces. The scope of the regular expression is narrowed to that word.

I also noticed that because of the above this also means that something like (800) 831-1117-213 3213212131321 will be considered a phone number.

from flutter_parsed_text.

erickjtorres avatar erickjtorres commented on September 21, 2024

The above still does not seem to work and further restricts it to using dashes because of the scoping of the word. I'll try to play around with it a bit and perhaps come up with a proposed solution.

from flutter_parsed_text.

erickjtorres avatar erickjtorres commented on September 21, 2024

Thats what I meant sorry for not explaining well. But it looks like it works well now! And the solution you have for it is great. Thanks for looking into the issue!

from flutter_parsed_text.

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.