Skip to content

Commit

Permalink
Merge pull request #14 from hantrungkien/main
Browse files Browse the repository at this point in the history
update regex && release v1.0.0-alpha04
  • Loading branch information
hantrungkien authored Oct 20, 2021
2 parents 0148c19 + f641507 commit 49ffd09
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Ability prepare data on background thread before it was drawn on main thread.
Gradle

```gradle
implementation 'vn.gapowork.android:rich-text:1.0.0-alpha03'
implementation 'vn.gapowork.android:rich-text:1.0.0-alpha04'
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ kotlin.code.style=official

GROUP=vn.gapowork.android
POM_ARTIFACT_ID=rich-text
VERSION_NAME=1.0.0-alpha03
VERSION_NAME=1.0.0-alpha04

POM_NAME=Rich Text
POM_DESCRIPTION=Dealing with Android Text by simple way to get high performance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import com.gapo.richtext.parser.RichTextMetadataParserSimpleCache
* @since 26/09/2021
*/
class RichTextHashtagMetadataParser(
regex: Regex = Regex("(#[a-zA-Z\\d][\\w-]*)"),
regex: Regex = Regex(HASHTAG_PATTERN),
cache: RichTextMetadataParserCache = RichTextMetadataParserSimpleCache
) : RichTextMetadataParser(regex, cache)
) : RichTextMetadataParser(regex, cache) {

companion object {
const val HASHTAG_PATTERN = "(#[a-zA-Z\\d][\\w-]*)"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import com.gapo.richtext.parser.RichTextMetadataParserSimpleCache
* @since 26/09/2021
*/
class RichTextMentionMetadataParser(
regex: Regex = Regex("(@[a-zA-Z\\d][\\w-]*)"),
regex: Regex = Regex(MENTION_PATTERN),
cache: RichTextMetadataParserCache = RichTextMetadataParserSimpleCache
) : RichTextMetadataParser(regex, cache)
) : RichTextMetadataParser(regex, cache) {

companion object {
const val MENTION_PATTERN = "(@[a-zA-Z\\d][\\w-]*)"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import com.gapo.richtext.parser.RichTextMetadataParserSimpleCache
* @since 26/09/2021
*/
class RichTextPhoneNumberMetadataParser(
regex: Regex = Regex("((\\+84|0)+[35789]+([0-9]{8})\\b)"),
regex: Regex = Regex(PHONE_NUMBER_PATTERN),
cache: RichTextMetadataParserCache = RichTextMetadataParserSimpleCache
) : RichTextMetadataParser(regex, cache)
) : RichTextMetadataParser(regex, cache) {

companion object {
const val PHONE_NUMBER_PATTERN = "((\\+84|0)+[35789]+([0-9]{8})\\b)"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ import com.gapo.richtext.parser.RichTextMetadataParserSimpleCache
* @since 26/09/2021
*/
class RichTextUrlMetadataParser(
regex: Regex = Regex(
"(work.gapo://)(\\S+)|(http://www.|https://www.|http://|https://|www.|[a-zA-Z0-9].)?[a-zA-Z0-9-]{1,}\\.?[a-z0-9-]{1,}\\.(?:ac|ad|aero|ae|af|ag|ai|al|am|an|ao|aq|arpa|ar|asia|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bi|blog|bj|bm|bn|bo|br|bs|bt|buzz|bv|bw|by|bz|cat|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|coop|com|co|cr|cu|cv|cx|cy|cz|dev|de|dj|dk|dm|do|dz|ec|edu|ee|eg|engineering|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gle|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|info|int|in|io|iq|ir|is|it|je|jm|jobs|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|link|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mobi|mo|mp|mq|mr|ms|mt|museum|mu|mv|mw|mx|my|mz|name|na|nc|net|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pro|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|top|to|tp|travel|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|viva|va|vc|ve|vg|vi|vn|vu|wf|ws|wiki|weibo|work|yahoo|yandex|ye|yoga|youtube|you|yt|yu|za|zip|zm|zw)(:[0-9]{1,5})?(/[\\S&&[^\\s(),]]+)?"
),
regex: Regex = Regex(URL_PATTERN),
cache: RichTextMetadataParserCache = RichTextMetadataParserSimpleCache
) : RichTextMetadataParser(regex, cache)
) : RichTextMetadataParser(regex, cache) {

companion object {
const val URL_PATTERN =
"(work.gapo://)(\\S+)|(http://www.|https://www.|http://|https://|www.|[a-z0-9].)?[a-z0-9-]{1,}\\.?[a-z0-9-]{1,}\\.?[a-z0-9-]{1,}\\.(?:ac|ad|aero|ae|af|ag|ai|al|am|an|ao|aq|arpa|ar|asia|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bi|blog|bj|bm|bn|bo|br|bs|bt|buzz|bv|bw|by|bz|cat|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|coop|com|co|cr|cu|cv|cx|cy|cz|dev|de|dj|dk|dm|do|dz|ec|edu|ee|eg|engineering|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gle|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|info|int|in|io|iq|ir|is|it|je|jm|jobs|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|link|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mobi|mo|mp|mq|mr|ms|mt|museum|mu|mv|mw|mx|my|mz|name|na|nc|net|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pro|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|top|to|tp|travel|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|viva|va|vc|ve|vg|vi|vn|vu|wf|ws|wiki|weibo|work|yahoo|yandex|ye|yoga|youtube|you|yt|yu|za|zip|zm|zw)(:[0-9]{1,5})?(/[\\S&&[^\\s(),]]+)?"
}
}

0 comments on commit 49ffd09

Please sign in to comment.