Skip to content

Commit

Permalink
updated url regex
Browse files Browse the repository at this point in the history
  • Loading branch information
dreampowder committed Nov 10, 2021
1 parent a5636c7 commit 9c57bcf
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [0.0.7] 10.11.2021
* Updated url regex so it can detect url's with "-" in it. (thanks https://github.com/Bhupesh-V for contributing)

## [0.0.6] 01.11.2021
* Added IncludeOnlyCases and IgnoreCases propertied into SocialTextSpanBuilder(context).build() method. You can now ignore matches or include matches

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ With version 0.0.3 you can also implement onTapDetection function for adding tap

# Acknowledgements

Thanks https://github.com/Bhupesh-V (@Bhupesh-V) for his contribution to url regex 👌

This widget's default regular expressions taken from this wonderful widget:

[detectable_text_field](https://pub.dev/packages/detectable_text_field)
Expand Down
2 changes: 1 addition & 1 deletion example/lib/text_span_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class SocialTextSpanExampleScreen extends StatefulWidget {

class _SocialTextSpanExampleScreenState extends State<SocialTextSpanExampleScreen> {

String exampleContent = "Lorem ipsum @dolor sit amet, consectetur adipiscing elit, sed do eiusmod @tempor incididunt ut labore et dolore magna aliqua. Ut #tellus elementum sagittis vitae et. Id #velit ut tortor pretium viverra suspendisse. Massa placerat duis ultricies lacus sed. @Placerat in egestas erat imperdiet sed euismod nisi. Velit scelerisque in dictum non consectetur. Massa id neque aliquam vestibulum morbi blandit. Purus sit amet volutpat consequat mauris nunc congue nisi. Ut diam quam nulla porttitor massa id. Sed faucibus turpis in eu mi. Rhoncus mattis rhoncus urna neque. Vel eros donec ac odio. Elit scelerisque mauris pellentesque pulvinar pellentesque habitant morbi tristique senectus. Lobortis elementum nibh tellus molestie nunc non blandit massa enim. Amet consectetur adipiscing elit duis tristique @sollicitudin nibh sit amet.\nhttp://www.google.com";
String exampleContent = "Lorem ipsum @dolor sit amet, consectetur adipiscing elit, sed do eiusmod @tempor incididunt ut labore et dolore magna aliqua. Ut #tellus elementum sagittis vitae et. Id #velit ut tortor pretium viverra suspendisse. Massa placerat duis ultricies lacus sed. @Placerat in egestas erat imperdiet sed euismod nisi. Velit scelerisque in dictum non consectetur. Massa id neque aliquam vestibulum morbi blandit. Purus sit amet volutpat consequat mauris nunc congue nisi. Ut diam quam nulla porttitor massa id. Sed faucibus turpis in eu mi. Rhoncus mattis rhoncus urna neque. Vel eros donec ac odio. Elit scelerisque mauris pellentesque pulvinar pellentesque habitant morbi tristique senectus. Lobortis elementum nibh tellus molestie nunc non blandit massa enim. Amet consectetur adipiscing elit duis tristique @sollicitudin nibh sit amet.\nhttp://www.google.com\n\https://bhupesh-v.github.io/";

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.5"
version: "0.0.6"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down
9 changes: 8 additions & 1 deletion lib/util/regular_expressions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@ const detectionContentLetters = _symbols +
_arabicLetters +
_thaiLetters;

// const urlRegexContent = "((http|https)://)(www.)?" +
// "[a-zA-Z0-9@:%._\\+~#?&//=]" +
// "{2,256}\\.[a-z]" +
// "{2,6}\\b([-a-zA-Z0-9@:%" +
// "._\\+~#?&//=]*)";

// Thanks to @Bhupesh-V for contribution.
const urlRegexContent = "((http|https)://)(www.)?" +
"[a-zA-Z0-9@:%._\\+~#?&//=]" +
"[a-zA-Z0-9@:%._\\+~#?&//=-]" +
"{2,256}\\.[a-z]" +
"{2,6}\\b([-a-zA-Z0-9@:%" +
"._\\+~#?&//=]*)";
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_social_textfield
description: TextEditingController and RichText / TextSpan builder with hashtag, url and mention detection with Regular Expressions. Also with tap support.
version: 0.0.6
version: 0.0.7
homepage: https://github.com/dreampowder/flutter_social_textfield

environment:
Expand Down

0 comments on commit 9c57bcf

Please sign in to comment.