cdkid Posted August 27, 2007 Share Posted August 27, 2007 (edited) I was just wondering if anyone could help me out to find a RegEx pattern that would help me with this. I've never actually used RegExp before and I'm a bit confused. Basically i have strings that look like this: 1 Zone: 14 X: 337.662079 Y: -4691.141602 Z: 16.457983 but the numbers between Zone: and X: change. Basically i just want to replace everything from Z to X with ", " (a comma and a space). I figured RegExp would be a bit easier than doing StringInStr loops. ~cdkid Edited August 28, 2007 by cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
tAKTelapis Posted August 28, 2007 Share Posted August 28, 2007 Sorry, but i am not so good with regular expressions, but i can give you this advice:A: Rename the thread to "String RegExp: Replace Items?" or something more descriptive other than "little help" or little help is what you will get.B: You gave the original string, can you give u a copy of it formated how you want it to come out the other side? Manually replace the items you need the script to change. Will make it easier, even with a lack of understanding Regular Expressions, i am finding it hard to visualize what it is you are after.After that, I am think the topic will have a better chance of drawing the attention of the correct people. Link to comment Share on other sites More sharing options...
cdkid Posted August 28, 2007 Author Share Posted August 28, 2007 (edited) Yeah, I renamed it from RegExp because people freak out when they see the word RegExp.... Everyone hates it, at least this way people look at it (It's a trap!) before edit: 1 Zone: 14 X: 337.662079 Y: -4691.141602 Z: 16.457983 This is how i want it to look after edit.. 1 , X: 337.662079 Y: -4691.141602 Z: 16.457983 All i have so far is StringRegExp($test, "(Z*X)", 2) this always returns just X tho, ideally i wanna be able to get Zone: 14 X in a variable, isolated. ~cdkid Edited August 28, 2007 by cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 28, 2007 Moderators Share Posted August 28, 2007 I was just wondering if anyone could help me out to find a RegEx pattern that would help me with this. I've never actually used RegExp before and I'm a bit confused. Basically i have strings that look like this: 1 Zone: 14 X: 337.662079 Y: -4691.141602 Z: 16.457983 but the numbers between Zone: and X: change. Basically i just want to replace everything from Z to X with ", " (a comma and a space). I figured RegExp would be a bit easier than doing StringInStr loops. ~cdkidYou could use back referencing ... but to keep it simple since you know the beginning and the end:Global $sString, $sNew $sString = "1 Zone: 14 X: 337.662079 Y: -4691.141602 Z: 16.457983" $sNew = StringRegExpReplace($sString, "(?s)(?i)Zone:.*?X", "Zone:, X") MsgBox(64, "info", $sNew) 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. Link to comment Share on other sites More sharing options...
cdkid Posted August 28, 2007 Author Share Posted August 28, 2007 Thanks so much, smoke. Really appreciate it. ~cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now