Sign in to follow this  
Followers 0
sanhen

StringRegExp String issues

15 posts in this topic

#1 ·  Posted (edited)

"-s |" start

The end of arbitrary letters and numbers

example:

-s|test12345

-s|232test

^([\/\-]s[\|])[a-zA-Z0-9]$

This is wrong, the right to express how ?

Edited by sanhen

Share this post


Link to post
Share on other sites



regexp could be a hard function to understand..

I'm not best but you can try downloading expresso,

http://www.ultrapico.com/Expresso.htm

I've found it very helpfull..

And theres a nice forum that is all about help in regexp

http://regexadvice.com/forums/default.aspx?GroupID=19

...

Share this post


Link to post
Share on other sites

"-s |" start

The end of arbitrary letters and numbers

example:

-s|test12345

-s|232test

^([\/\-]s[\|])[a-zA-Z0-9]$

This is wrong, the right to express how ?

What exactly are you trying to capture? Everything after -s| ?

In that case, use this: ^-s\|(.*)$

Share this post


Link to post
Share on other sites

"-s |" start

The end of arbitrary letters and numbers

example:

-s|test12345

-s|232test

^([\/\-]s[\|])[a-zA-Z0-9]$

This is wrong, the right to express how ?

Flag 3

(?:-s\|)(.*)

You could also just do

$Split = StringSplit($Text, "|")

$Split[1] = -s

$Split[2] = test12345

FYI I wrote a pretty nice SRE/SRER tester. It's in my sig=)

Share this post


Link to post
Share on other sites

$aArray=StringRegExp("-s|abcde123456","^-s\|(.*)$",3)

MsgBox(0,"test",$aArray[0])

Tanks ....very good!

Share this post


Link to post
Share on other sites

Hi sanhen,

Doing a search of your topic, it's been found many times with the search feature or is listed as a non-descriptive topic.

Please do a search before posting new thread topics.

And please use descriptive topics so that others that do use the search feature may also find what they are seeking.

(You'll also find that using descriptive topics, will get people in your thread that know how to answer your questions, those same people ignore non-descriptive topics).

Thanks.

Share this post


Link to post
Share on other sites

:)

next time 问我


Share this post


Link to post
Share on other sites

Hi sanhen,

Doing a search of your topic, it's been found many times with the search feature or is listed as a non-descriptive topic.

Please do a search before posting new thread topics.

And please use descriptive topics so that others that do use the search feature may also find what they are seeking.

(You'll also find that using descriptive topics, will get people in your thread that know how to answer your questions, those same people ignore non-descriptive topics).

Thanks.

Look bro. I don't know if your self appointed or highered for 'official' lame responses. But this question isn't something that would get answered by a search.

String RegEx'ing can be very hard for some people. And what would he have searched for?

"^([\/\-]s[\|])[a-zA-Z0-9]$ "?

Give him a break. Seriously...

:)

next time 问我

不要要求他。 他不知道什么他做着

Share this post


Link to post
Share on other sites

Look bro. I don't know if your self appointed or highered for 'official' lame responses. But this question isn't something that would get answered by a search.

String RegEx'ing can be very hard for some people. And what would he have searched for?

"^([\/\-]s[\|])[a-zA-Z0-9]$ "?

Give him a break. Seriously...

RegEx questions can be broken up into an actual question or description of the issue you are having.

There are 2 options when posting a new thread.

1. Title

2. Description

So a title example could be:

Title: StringRegExp

Description: Issue capturing all characters after found sub string.

Now to be honest, if he only wants characters a-zA-Z0-9 he was real close

^([\/\-]s[\|])[a-zA-Z0-9]$
should have been
^-s\|[a-zA-Z0-9]+$
He was only missing the "+" sign. Or he could even do:
^-s\|(\w+)

I wouldn't use .*? is because * says that there may or may not be any value after -s| and it will still return an array, and "." says "any character" and the OP is shows they only want word characters.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

We're sorry. I described the question of translation from google

$aArray=StringRegExp("/s|564564test|sdf12345","^\/s\|(.*)\|(.*)$",1)

MsgBox(0,"test",$aArray[0])

Continue to ask, I need to return to:

564564test|sdf12345

Edited by sanhen

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

We're sorry. I described the question of translation from google

$aArray=StringRegExp("/s|564564test|sdf12345","^\/s\|(.*)\|(.*)$",1)

MsgBox(0,"test",$aArray[0])

Continue to ask, I need to return to:

564564test|sdf12345

If you continue to change the parameters of your question... you may never find an answer. Providing as much pertinent information as possible (Like what you actually want) is what gets people what they actually need.

^/s\|(\w+\|\w+)\z

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

$aArray=StringRegExp("/s|pass1234|\\server","^/s\|(\w+\|\w+)",3)

MsgBox(0,"test",$aArray[0])

F:\tools\AutoIt\?????\?? AutoIt v3 Script.au3 (4) : ==> ???????????.:

MsgBox(0,"test",$aArray[0])

MsgBox(0,"test",$aArray^ ERROR

Share this post


Link to post
Share on other sites

You are changing it again.

Do you see that?


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

$aArray=StringRegExp("/s|pass1234|\\server","^/s\|(\w+\|\w+)",3)

MsgBox(0,"test",$aArray[0])

F:\tools\AutoIt\?????\?? AutoIt v3 Script.au3 (4) : ==> ???????????.:

MsgBox(0,"test",$aArray[0])

MsgBox(0,"test",$aArray^ ERROR

Come on now. That's rediculous. You should go download RegExBuddy or RegExCoach and learn some regex before even trying it.

^/s\|(.+?\|.+?)\z

You were only ever looking for word characters, now you're saying it can be any character.

You always error check as well.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

thanks.I will try to resolve this. This is the code.

$aArray=StringRegExp("/s|pass1234|\\server","^/s\|(.*\|.*)",3)

MsgBox(0,"test",$aArray[0])

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