Sign in to follow this  
Followers 0
Xibalba

[Solved] RegExp help needed

3 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You need to spot pattern. Apparently it's: anything-space-number(any size)-#-number(any size)-space-anything

Now open AutoIt help file and you are done in 5 minutes.

edit: or UEZ could try solving this.

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
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
Sign in to follow this  
Followers 0