sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #31997
Re: [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/265776
Description changed to:
In sikuli I've get a multiline string from clipboard like this...
Names = App.getClipboard();
Name =
#corazona
#Pebleo00
#cofriasd
«paflio
and I have use this regex to delete the first character
if it is not in x00-x7f hex range or is not a word, or is a digit
import re
Names = re.sub(r"(?m)^([^\x00-\x7F]+|\W|\d)", "", Names)
So now...
Names =
corazona
Pebleo00
cofriasd
paflio
I am having trouble with the second regex that convert "Names" into a kinda List
I would like to convert "Names" into...
'corazona', 'Pebleo00', 'cofriasd', 'paflio',
So sikuli can then recognize it as a List by using...
NamesAsList = eval(Names)
in order to get a proper List to work with
How could I do this in python? is it necessary to use regex, or there is
other way to do this in python?
I have already done this but using .Net regex, I just don't know how to do it in python, I have googled it with no result.
This is how I did it using .Net regex
Text to find:
(.*[^$])(\r\n|\z)
Replace with:
'$1',%" "%
Thanks Advanced.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.