Jump to content

stringregexp problem


Recommended Posts

Hi everyone,

I'd like to ask here my question because I tried myself without success with StringRegExp for the last 2 hours

I have a string like this:

" abc defgh jklm "

and I want to return an array like this:

$array[0]="abc"

$array[1]="defgh" 

$array[2]="jklm"

Can anyone give me some help please?

Link to comment
Share on other sites

4 minutes ago, d112 said:

thank you, it works

I only changed 

[a-z]

with

[a-z,A-Z,0-9]

 

If you use the code that jguinch left, you don't have to bother with that. It will match anything that isn't a space. It's better than mine.

Link to comment
Share on other sites

unless there are other criteria, with no regex:

#include<array.au3>

$s_Test = " abc defgh jklm "
_ArrayDisplay(stringsplit(stringstripws($s_Test , 3) , " " , 2))

 

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

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