Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Add URL formatting #13

Closed
snamstorm opened this issue Dec 28, 2020 · 5 comments
Closed

Suggestion: Add URL formatting #13

snamstorm opened this issue Dec 28, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@snamstorm
Copy link

snamstorm commented Dec 28, 2020

We're using react-native-parsed-text library to show the hashtags and URL formatting. We only highlight the URL by changing its style(no hiding the link).

The regEx used for URL:

  1. Short: /\bhttps?:\/\/\S+/gi
  2. Long: /(https?:\/\/|www\.)[-a-zA-Z0-9@:%._\+~#=]{1,256}\.(xn--)?[a-z0-9-]{2,20}\b([-a-zA-Z0-9@:%_\+\[\],.~#?&\/=]*[-a-zA-Z0-9@:%_\+\]~#?&\/=])*/i

Below is the screenshot of the TextInput which I'm using:

Screenshot 1942-10-07 at 5 46 28 PM

@snamstorm snamstorm mentioned this issue Dec 28, 2020
@dabakovich dabakovich added the enhancement New feature or request label Dec 28, 2020
@snamstorm
Copy link
Author

@dabakovich just wondering if you will be looking at this anytime soon please? Thanks!

dabakovich added a commit that referenced this issue Jan 10, 2021
Added `partTypes` property for defining list of possible mention types or patterns for parsing.
Updated README.md.
Added tests for new method for parsing value.

BREAKING CHANGES: `mentionTypes` renamed to `partTypes`. `MentionType` changed to `PartType` which can be either `MentionPartType` or `PatternPartType`. New types defined in README.md.
@dabakovich
Copy link
Owner

Hey @snamstorm! The feature is available now on alpha 2.0.0-0. Please test it and tell me if you'll get any issues.

@snamstorm
Copy link
Author

@dabakovich thanks - tested and this works well.

Can we merge to master branch and make a new release please?

@dabakovich
Copy link
Owner

Sure, v2.0.0 is now available for download. Please close the issue if you don't have any other questions.

@antochan
Copy link

@snamstorm why is it that using your short regex /\bhttps?:\/\/\S+/gi the matched text actually just automatically gets deleted.

Screen.Recording.2024-03-13.at.12.35.08.PM.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants