Jump to content

Need help with StringRegExp


Recommended Posts

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]

Link to comment
Share on other sites

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]
Link to comment
Share on other sites

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
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...