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

updated the regex for url for proper recognition #13

Merged
merged 3 commits into from Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/ios/Podfile.lock
Expand Up @@ -14,7 +14,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/path_provider/ios"

SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
Expand Down
24 changes: 12 additions & 12 deletions example/pubspec.lock
Expand Up @@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.9.0"
version: "2.8.2"
boolean_selector:
dependency: transitive
description:
Expand All @@ -21,7 +21,7 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
version: "1.2.0"
charcode:
dependency: transitive
description:
Expand All @@ -35,7 +35,7 @@ packages:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
version: "1.1.0"
collection:
dependency: transitive
description:
Expand Down Expand Up @@ -63,7 +63,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
version: "1.3.0"
ffi:
dependency: transitive
description:
Expand Down Expand Up @@ -122,28 +122,28 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.12"
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.5"
version: "0.1.4"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.7.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
version: "1.8.1"
path_provider:
dependency: transitive
description:
Expand Down Expand Up @@ -218,7 +218,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
version: "1.8.2"
stack_trace:
dependency: transitive
description:
Expand All @@ -239,21 +239,21 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.12"
version: "0.4.9"
typed_data:
dependency: transitive
description:
Expand Down
6 changes: 5 additions & 1 deletion lib/src/utils/regex.dart
@@ -1,6 +1,10 @@
import 'package:linkfy_text/src/enum.dart';

String urlRegExp = r'(?:(?:https?|ftp):\/\/)?[\w/\-?=%.]+\.[\w/\-?=%.]+';
// String urlRegExp =

// url regex that accept https, http, www
String urlRegExp =
r'((https?://)?(www\.)?[a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*))';

String hashtagRegExp = r'(#+[a-zA-Z0-9(_)]{1,})';

Expand Down
28 changes: 14 additions & 14 deletions pubspec.lock
Expand Up @@ -28,7 +28,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.9.0"
version: "2.8.2"
boolean_selector:
dependency: transitive
description:
Expand All @@ -42,7 +42,7 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
version: "1.2.0"
charcode:
dependency: transitive
description:
Expand All @@ -56,7 +56,7 @@ packages:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
version: "1.1.0"
collection:
dependency: transitive
description:
Expand Down Expand Up @@ -91,7 +91,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
version: "1.3.0"
file:
dependency: transitive
description:
Expand Down Expand Up @@ -171,21 +171,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.12"
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.5"
version: "0.1.4"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.7.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -213,7 +213,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
version: "1.8.1"
pedantic:
dependency: transitive
description:
Expand Down Expand Up @@ -295,7 +295,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
version: "1.8.2"
stack_trace:
dependency: transitive
description:
Expand All @@ -316,35 +316,35 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
version: "1.2.0"
test:
dependency: "direct dev"
description:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.21.4"
version: "1.21.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.12"
version: "0.4.9"
test_core:
dependency: transitive
description:
name: test_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.16"
version: "0.4.13"
typed_data:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion test/utils/regex_test.dart
Expand Up @@ -99,7 +99,7 @@ void main() {
expect(hashtagRegExp.allMatches(hashtagText).length, 2);
expect(emailRegExp.allMatches(emailText).length, 2);
expect(phoneRegExp.allMatches(phoneText).length, 2);
expect(textRegExp.allMatches(text).length, 10);
expect(textRegExp.allMatches(text).length, 9);
});
});
}