Jump to content

[Solved] RegExp help needed


Xibalba
 Share

Recommended Posts

Hey, I've just started experimenting with regexp..

I don't even know how to begin coding an expression that finds x and y in examples as follows:

Lorem ipsum dolor x#y sit amet

Vivamus x#y porta metus non purus congue mollis.

Fusce feugiat nunc vel mi accumsan vel dictum dolor x#y tincidunt.

Etiam nibh odio, tempor eu euismod x#y id, cursus id dolor.

  • x and y are always integers (i.e 2, 10, 141)
  • the lines can contain all kinds of characters (but only one '#')

Perhaps someone can start me off, guiding me in the right direction?

Thx

Edit: Thanks, works splendid.

Edited by Xibalba
Link to comment
Share on other sites

Try this:

#include <Array.au3>
$text = "Lorem ipsum dolor 1#3 sit amet" & @CRLF & _
        "Vivamus 2#4 porta metus non purus congue mollis." & @CRLF & _
        "Fusce feugiat nunc vel mi accumsan vel dictum dolor 11#23 tincidunt." & @CRLF & _
        "Etiam nibh odio, tempor eu euismod 13#14 id, cursus id dolor."

$aRegEx = StringRegExp($text, "(.\d#\d.)", 3)
_ArrayDisplay($aRegEx)

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...