Beele 3 Posted January 15, 2013 Report Share Posted January 15, 2013 Hi i´ll scrape adresses like this <div class="address"> <h3>Christian Friedman</h3> <div class="adr"> Rosenstrasse 55<br>81335 München </div> </div>and safe all, but the firstame without a space on the end. I have set this: set(#first name, $find regular expression($list item(%info, 0), ".+ "), "Global")and that´s it: Christian ,Friedmann,...... but not good for generate a #username like this: set(#username, "{$table cell(&scraped info, #creation loop, 0)}0{$rand(1, 92)}", "Global") Can anyone help me to safe the firstname or generate the username without this space ? thx Quote Link to post Share on other sites
VaultBoss 310 Posted January 15, 2013 Report Share Posted January 15, 2013 set(#first name, $find regular expression($list item(%info, 0), ".+ "), "Global") The regex symbol for space is an escaped 's', like this: \s Your code should look maybe rather like this: set(#first name, $find regular expression($list item(%info, 0), "((.)+)"), "Global")Notice the lack of spaces. If you want to add a space, it should be: set(#first name, $find regular expression($list item(%info, 0), "((.)+)\\s"), "Global") If the space can be omitted sometimes, you could add a modifier: set(#first name, $find regular expression($list item(%info, 0), "((.)+)\\s?"), "Global")etc... Play with your REGEX here: http://rubular.com/ Hope it helps you... 2 Quote Link to post Share on other sites
Beele 3 Posted January 16, 2013 Author Report Share Posted January 16, 2013 Thanks @VaultBoss for your help ! The problem was not to scrape it with Regex, but i have found it !! I need to $trim the $find regular expression and it works. I´m happy! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.