Jump to content
Sign in to follow this  
BlackDragonBE

Regex problem [SOLVED]

Recommended Posts

BlackDragonBE

Hi guys,

I have a small problem, I have the following text:

Sortie
Nouveau
Ouvrir
Radio
Radio
Liste des données
Modif
Données
ListBox
Tabellen
ListBox
X
Liste des classes
Nom:
ABC_VDAT
Type:
Enkelvoudig
Libellé:
Begindatum
Vrij
Liste des données
Modif
Valider
Bitmap
Line
Liste des données
Caractéristiques
Tabel:
ABSCODE
Kolom:
VDAT
Line
Type:
d
Masque:
dd/dd/dddd
Lg :
 10
cadr :
Standaard
Line
Plage valeurs:
Valeur défaut:
Line
Audit

I need to get the text in red:

Liste des classes

Nom:

ABC_VDAT

Type:

Enkelvoudig

I know it's always between "Nom:" and "Type:", I've been struggeling to get only that part of the text out..

I'm not used to using regex, so I've been searching on google, but none of it made sense to me, I tried several ways but none worked.

Can anyone please help?

Thanks in advance,

BlackDragonBE

Edited by BlackDragonBE

Share this post


Link to post
Share on other sites
picaxe

This works for me

$aRet = StringRegExp($string, '(?i)nom:(?>\r\n|\n)?(\S*)(?>\r\n|\n)?type:', 3)
_ArrayDisplay($aRet)

Share this post


Link to post
Share on other sites
TerarinK

Is this on multiple topics that has this same format? If it is then I would just check for Nom: case insensitive at that and retrieve the next line.


0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites
Valuater

I would just use a simple string-between function

$Text = _StringBetween($String, "Nom:", "Type:")
MsgBox(0x0,"Test", $Text[1])

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
BlackDragonBE

Thanks a lot everyone!

I decided to use Valuater's code, as it's the most simple. :D

It's $Text[0] by the way I think, because it worked like a charm with a 0, but failed with a 1. :o

Thanks again!

BlackDragonBE

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  

×