LearningRegex - Parse links from text via RegEx

Overview

Parse links from text via RegEx

Supported types:

  • Hashtags
  • Urls
  • emails

Using in project:

import EXPHelper.parseWords


fun main(args: Array<String>) {
    val data = parseWords(
        "Hello, my name is Boris, i live in #Samara "+
                "you can contact me via email: [email protected] "+
                "Or find me on Telegram: https://t.me/fck_st"+
                "Thanks!"
    )

    // It returns list of all parsed elements like urls, emails and hashtags
    println("Any: $data \n")

    // The WordModel contains a some information, for example you get data with filter
    // This example returns only hashtags
    println("Only hashtags: ${data.filter { it.type == WordType.HASHTAG }}")

}

Output:

Any: [
    WordModel(
        word=#Samara, 
        startIndex=35, 
        endIndex=42, 
        type=HASHTAG),
    WordModel(
        [email protected], 
        startIndex=73, 
        endIndex=96, 
        type=EMAIL), 
    WordModel(
        word=https://t.me/fck_stThanks, 
        startIndex=121, 
        endIndex=146, 
        type=URL)
    ] 

Only hashtags: [
    WordModel(
    word=#Samara, 
    startIndex=35, 
    endIndex=42, 
    type=HASHTAG)
    ]

"startIndex" and "endIndex" means position of chars in original text.

Which types we can use:

Currently it has only three types: Hashtags, Emails, and Urls

You might also like...
A library that gives full control over text related technologies such as bidirectional algorithm, open type shaping, text typesetting and text rendering
A library that gives full control over text related technologies such as bidirectional algorithm, open type shaping, text typesetting and text rendering

Tehreer-Android Tehreer is a library which gives full control over following text related technologies. Bidirectional Algorithm OpenType Shaping Engin

Speech-Text Converter is a simple task that enable the user to convert the speech to text or convert text to speech (by Mic)
Speech-Text Converter is a simple task that enable the user to convert the speech to text or convert text to speech (by Mic)

Speech-Text Converter About Speech-Text Converter is a simple task that enable the user to convert the speech to text or convert text to speech (by Mi

This SDK can be used to identify a user via passport or ID Card prove identity of user via Biometry comparing selfie and photo from chip of ID Doc
This SDK can be used to identify a user via passport or ID Card prove identity of user via Biometry comparing selfie and photo from chip of ID Doc

Verdi Mobile SDK This SDK can be used to identify a user via passport or Id Card. In this repository, you can find the library itself and the Sample a

This SDK can be used to identify a user via passport or ID Card prove identity of user via Biometry comparing selfie and photo from chip of ID Doc A simple library for parsing and playing links from YouTube, YouTube Music, Vimeo and Rutube is WebView without the need to connect api data services. Request caching is available now
A simple library for parsing and playing links from YouTube, YouTube Music, Vimeo and Rutube is WebView without the need to connect api data services. Request caching is available now

Android Oembed Video A simple library for parsing and playing links from YouTube, YouTube Music, Vimeo and Rutube and others in the WebView without th

Linkester is an Android library that aims to help Android developers test their deep links implementation.
Linkester is an Android library that aims to help Android developers test their deep links implementation.

Linkester Linkester is an Android library that aims to help Android developers test their deep links implementation. The idea is to have a new launche

PhpStorm Plugin to create clickable links to github repository

composer-links Template ToDo list Create a new IntelliJ Platform Plugin Template project. Get known with the template documentation. Verify the plugin

Create one-time links for securely sending data

Dead Drop Service Send One-Time Secrets in a secure way A Dead Drop service written in Kotlin / KTor. This service uses sjcl on client-side to encrypt

Link-converter - A web service that converts links between web url and deeplink for mobile and web applications

Deep Link Converter Linkleri, mobil ve web uygulamaları için web url ile deeplin

DrawRoute wraps Google Directions API (https://developers.google.com/maps/documentation/directions/) using RxJava for Android so developers can download, parse and draw path on the map in very fast and flexible way (For now only JSON support). 📲Android library to parse open graph tags (ogTags) from given URL.
📲Android library to parse open graph tags (ogTags) from given URL.

ogTagParser Android library to parse open graph tags (ogTags) from given URL. Getting Started Step 1. Add the dependency Root Level Build.gradle file

A cup of library to Parse RSS for android. Also available as a ConverterFactory for Retrofit & Fuel

ParseRSS RSS Parser for android Simple, concise, and extensible RSS Parser in the entire coffee shop. It can capture these information from the RSS ar

Basic application that uses Retrofit, Moshi and Coil libraries to parse data from web API

DogAlbum_Api_CodeThrough Basic application that uses Retrofit, Moshi and Coil libraries to parse data from web API This folder contains the completed

ZATAC Scanner is Android Kotlin-based QR code scanner and parser which de-crypt TLV qr codes and parse them into their values.
ZATAC Scanner is Android Kotlin-based QR code scanner and parser which de-crypt TLV qr codes and parse them into their values.

ZATAC Scanner is Android Kotlin-based QR code scanner and parser which de-crypt TLV qr codes and parse them into their values.

A tiny Android app that can receive WhatsApp group message export files and parse message history stats.

A tiny Android app that can receive WhatsApp group message export files and parse message history stats.

Xoxo is a simple wrapper around org.w3c.dom to parse XML using nice Kotlin APIs

Xoxo 😘 Xoxo is a simple wrapper around org.w3c.dom to parse XML using nice Kotlin APIs. No more NodeList, .item(), etc... just use .children, .filter

Danger-kotlin plugin to parse and report Detekt violations
Danger-kotlin plugin to parse and report Detekt violations

Detekt Plugin for Danger Kotlin Plugin for danger/kotlin which helps to parse and report detekt violations from its XML report files. How it looks lik

MachOParser is a Kotlin library to parse Mach-O files

MachOParser MachOParser is a Kotlin library to parse Mach-O files Mach-O is a file format for executables, shared libraries and related binaries. This

A editable text with a constant text/placeholder for Android.
A editable text with a constant text/placeholder for Android.

ParkedTextView A EditText with a constant text in the end. How to use com.goka.parkedtextview.ParkedTextView xmlns:app="http://schemas.android.co

Owner
Boris
Boris
A cup of library to Parse RSS for android. Also available as a ConverterFactory for Retrofit & Fuel

ParseRSS RSS Parser for android Simple, concise, and extensible RSS Parser in the entire coffee shop. It can capture these information from the RSS ar

Muhammad Rifqi Fatchurrahman 23 Dec 10, 2022
It's finally easy to take photos/videos via camera or get photos/videos from gallery on Android.

Shutter-Android It's finally easy to take photos/videos via camera or get photos/videos from gallery on Android. What is Shutter? Shutter is an Androi

Levi Bostian 56 Oct 3, 2022
SPIDlibraryAndroid is a library for logging in via SPID through several different identity providers.

SPIDlibraryAndroid SPIDlibraryAndroid is a library for logging in via SPID through several different identity providers.

INPS 98 Dec 15, 2022
Migrating from one PostgreSQL to another via S3

Migrating from one PostgreSQL to another via S3 In one terminal start initial setup. ./gradlew buildDockerImage docker-compose up --build dbmig-s3 dbm

Stefan Bissell 1 May 19, 2022
A tool to validate text inside TextInputLayout

Download dependencies { implementation 'com.github.anderscheow:validator:2.2.1' } Usage Available rules LengthRule MaxRule MinRule NotEmptyRule NotN

Anders Cheow 129 Nov 25, 2022
Multiplaform kotlin library for calculating text differences. Based on java-diff-utils, supports JVM, JS and native targets.

kotlin-multiplatform-diff This is a port of java-diff-utils to kotlin with multiplatform support. All credit for the implementation goes to original a

Peter Trifanov 51 Jan 3, 2023
Matches incoming and/or outgoing text messages against set rules and sends them over to webhook.

Textmatic If you ever wanted a tool to simply push the SMS (or text messages) from your phone to somewhere remote, this is it. This app matches all in

Float 2 Jan 7, 2022
Same as the Outlined text fields presented on the Material Design page but with some dynamic changes. 📝 🎉

README SSCustomEditTextOutlineBorder Getting Started SSCustomEditTextOutLineBorder is a small kotlin library for android to support outlined (stroked)

Simform Solutions 194 Dec 30, 2022
Draw Text on any Pixelflut Canvas.

PixelJet A PixelFlut tool which paints the given text to the canvas. It connects to a running Pixelflut server, renders the text with a given font and

Markus Pöschl 0 Apr 30, 2022
Uma biblioteca completa e performática para destacar trechos de textos usando Spannable com Expressões Regulares (Regex) para Android.

Highlight Uma biblioteca completa e performática para destacar trechos de textos usando Spannable com Expressões Regulares (Regex) para Android totalm

Irineu A. Silva 16 Dec 22, 2022