Regular Expressions (RegEx) To convert to ahk code Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Sheldz
Posts: 6
Joined: 21 Apr 2018, 10:55

Regular Expressions (RegEx) To convert to ahk code

22 Apr 2018, 11:01

Hi Everyone,

I need help in putting this regular expression into code. (String/Haystack below).

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



(?<=number\s).*||(?<=Invoice\sto\s).*|(?<=Proforma\s).*(?=\sProduction)|(?<=person\s).*(?=\sDelivery)
I find the Customer ID, Sales Person, Proforma Number with the regex above. I would then save these contents into a variable called firstStrings for use with the end step


\d{0,5}\s(?<!R\s)\d{1,4}\,\d{1,4}.+$
I then use the above to search for the below values and would then need to delete these numbers and in then place a one comma in their place

490,00 490,00 0,00 0,00 490,00
0,00 0,00 0,00 0,00 0,00
556,99 556,99 0,00 0,00 556,99

So now the entire string looks like this:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus




(?<=number\s).*||(?<=Invoice\sto\s).*|(?<=Proforma\s).*(?=\sProduction)|(?<=person\s).*(?=\sDelivery)
Using this regex I get to now select the line item products only and then keep those and delete everything else in the string

Code: [Select all] [Download] GeSHi © Codebox Plus

1 Corporate Flag -
Single Sided -
Digital
Sundry 1200 x
900,
1 Wind Cheater Banners Deluxe - Single N/A
Sided - Digital
3m,
1 Corporate Flag - Single Sided - Digital N/A Custom,


Then I search for every newline (\n) character then do a backspace with one space to get the following

Code: [Select all] [Download] GeSHi © Codebox Plus

1 Corporate Flag - Single Sided - Digital Sundry 1200 x 900, Wind Cheater Banners Deluxe - Single N/A Sided - Digital 3m, 1 Corporate Flag - Single Sided - Digital N/A Custom,


- Search for each comma with (?<=,). and replace with a newline.
- Then find the end of the string with $ and delete those commas
- Lastly add a comma to the beginning numbers of each line ^\d{1,5}\K\s

Code: [Select all] [Download] GeSHi © Codebox Plus

1, Corporate Flag - Single Sided - Digital Sundry 1200 x 900
1, Wind Cheater Banners Deluxe - Single N/A Sided - Digital 3m
12, Corporate Flag - Single Sided - Digital N/A Custom


And finally with this new variable of list items I find the beginning of each line with ^ and concatenate them with the firstStrings which we found in the beginning.

Code: [Select all] [Download] GeSHi © Codebox Plus

firstStrings.1, Corporate Flag - Single Sided - Digital Sundry 1200 x 900
firstStrings.1, Wind Cheater Banners Deluxe - Single N/A Sided - Digital 3m
firstStrings.12, Corporate Flag - Single Sided - Digital N/A Custom


Long post but i hope someone can help
Last edited by Sheldz on 28 Apr 2018, 00:26, edited 1 time in total.
User avatar
AlphaBravo
Posts: 363
Joined: 29 Sep 2013, 22:59

Re: Regular Expressions (RegEx) To convert to ahk code  Topic is solved

28 Apr 2018, 11:16

I hope this helps:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Sheldz
Posts: 6
Joined: 21 Apr 2018, 10:55

Re: Regular Expressions (RegEx) To convert to ahk code

28 Apr 2018, 15:23

Thank you so much this gives me a general idea of what to do! I needed the commas and the regex to select those matches like i can in sublime, but this is stuff I can try play and figure out.

I appreciate you taking the time out to read that long post lol

Return to “Ask For Help”

Who is online

Users browsing this forum: jacus1000, Mipha, TimeToHotkey and 50 guests