Comments (6)
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"
from flutter_parsed_text.
ok, I think this regex would work great ^\s*(?:\+?(\d{1,3}))?[-. (]*(\d{3})[-. )]*(\d{3})[-. ]*(\d{4})(?: *x(\d+))?\s*$
from flutter_parsed_text.
@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.
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.
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.
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)
- pattern match text not showing unless putting space after string
- Customization HOT 2
- Lack of flags/modifiers HOT 1
- can you support onLongPress on top of onTap?
- Is it possible to have custom options with selectable enabled?
- Migrate to null safety
- renderText argument/parameter Type mismatch HOT 1
- Your email regex is very wrong HOT 1
- Global regexOptions HOT 20
- Null Check operator on Null value error HOT 2
- onTap uses matchText instead of result['value'] when using renderText HOT 1
- Not working while trying to parse utf8 unicode data.
- Feature Request: Allow usage with Expand_widget
- Email parsing is not working as expected for particular emails
- Selecte and copy CUSTOM widgetSpan then paste the text is an unknown character of an obj. HOT 4
- Missing param : toolBarOptions
- add see more or see less HOT 1
- See more and see less button (expandable)
- why not using marked?
- next update of flutter_paresed_text
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_parsed_text.