Jump to content
Sign in to follow this  
GrungeRocker

Need help with StringRegExp

Recommended Posts

GrungeRocker

Hi.

I need to varify a string. So I just want to check, if the string uses valid characters.

Allowed characters are:

*

_

L

N

n

"any text with numbers in it"

'any text with numbers in it'

I tried it with

$validpattern = '[*_LNn]"(.*?)"'
$validpattern = $validpattern & "'(.*?)'"

but that does not work.

I really don't get those expressions....

May someone help me?


[font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font]

Share this post


Link to post
Share on other sites
system24

Let me test... [Can't test here. AutoIt's broken.]

$validpattern = '([0-9][*_LNn])'
Edited by system24

[center]It's a question of mind over matter, if I don't mind, it doesn't matter.[/center]

Share this post


Link to post
Share on other sites
GrungeRocker

The Text is only allowed to be in " " and ' '


[font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font]

Share this post


Link to post
Share on other sites
Izebize

Try this:

$validpattern   =   '(?:[*_LNn]|"(.*?)"'
$validpattern   &=  "|'(.*?)')"

Share this post


Link to post
Share on other sites
GrungeRocker

No =(

_*_N*"text""

Seems valid to it, but the last " is not closed =((

Edited by GrungeRocker

[font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font]

Share this post


Link to post
Share on other sites
GrungeRocker

*push*

Please help...


[font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font]

Share this post


Link to post
Share on other sites
Authenticity

Dim $sStr = "L'abcdefghijklmnopqrstuvwxyz1234567890'"
Dim $sPatt = "([_nNL*](['""])([^\2]*)\2)"

Dim $aMatch = StringRegExp($sStr, $sPatt, 1)
ConsoleWrite(@error & @TAB & @extended & @LF)

If IsArray($aMatch) Then
    For $i = 0 To UBound($aMatch)-1
        ConsoleWrite($aMatch[$i] & @LF)
    Next
EndIf

Edited by Authenticity

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  

×