How to remove specific values from clipboard?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Sabestian Caine
Posts: 528
Joined: 12 Apr 2015, 03:53

How to remove specific values from clipboard?

12 Aug 2016, 02:35

Friends I want that specific values should be removed from the copied data (clipboard). For example I have following data in clipboard-
  • 12-08-16
    12-08-16
    12-08-16
    12-08-16
    DL10587
    DL10575
    DL11318
    DL2514
    DL8526
    DL36521
    DL7485
    70,000.00
    14,700.00
    3,000.00
I want that when I press f1 key then all the dates (i.e. 12-08-16) should be removed and the alpha-numeric values which start from letter “D” (i.e. DL10587, DL10575, DL11318, DL2514, DL8526, 36521 and DL7485) should also be removed from clipboard. Here I am saying the alpha-numeric values which start from the letter “D” because every time I copy the data these values keep changing, however the dates remain same. So after removing dates and the alpha-numeric values which starts from letter D, there should remain the numeric values only in the clipboard which are-70,000.00, 14,700.00 and 3,000.00. please help me to solve this issue. Thanks a lot.
I don't normally code as I don't code normally.
Shadowpheonix
Posts: 1259
Joined: 16 Apr 2015, 09:41

Re: How to remove specific values from clipboard?

12 Aug 2016, 12:35

Code: Select all

F1::
Clipboard := Trim(RegExReplace(Clipboard, "m)^(\d\d-\d\d-\d\d)$|^(D[^\d]?\d*)$", ""), " `r`n`t")    ; This will work even if the dates change.
Return
User avatar
Sabestian Caine
Posts: 528
Joined: 12 Apr 2015, 03:53

Re: How to remove specific values from clipboard?

14 Aug 2016, 02:20

Shadowpheonix wrote:

Code: Select all

F1::
Clipboard := Trim(RegExReplace(Clipboard, "m)^(\d\d-\d\d-\d\d)$|^(D[^\d]?\d*)$", ""), " `r`n`t")    ; This will work even if the dates change.
Return
Thanks dear Shadowpheonix the codes suggested by you are working as i want exactly ....you are really great at ahk.....i appreciate your skills and abilities.....thanks a lot once again.... :clap: :clap: :clap: :clap: :clap:
I don't normally code as I don't code normally.
User avatar
Sabestian Caine
Posts: 528
Joined: 12 Apr 2015, 03:53

Re: How to remove specific values from clipboard?

28 Aug 2016, 13:05

Shadowpheonix wrote:

Code: Select all

F1::
Clipboard := Trim(RegExReplace(Clipboard, "m)^(\d\d-\d\d-\d\d)$|^(D[^\d]?\d*)$", ""), " `r`n`t")    ; This will work even if the dates change.
Return
Dear shadowpheonix...could you please make me understand why these codes have been used like this here. I tried to read the documentation part of RegExReplace but i could not understand much. i request you to make me understand few of these symbols from above codes-

Code: Select all

clipboard - is haystack i.e. whose content is to be processed, as far as i know
"m - as far as i read the documentation part "m means haystack is multi line. Please tell me more about using "m in RegExReplace command
^ - as far as i know this symbol is used to combine two statements and is used at the beginning. please elaborate this symbol 
\d\d - as far as i read the documentation part \d is used to match any single digit. but here you used three sets of \d\d i dont know why you used three sets of \d\d please tell me.
$ - this sign is used at the end of line. kindly elaborate this sign
| -  i dont know about this sign
D - again you used capital D i do not know why. i think it is to remove alphanumeric values which starts from letter D. please tell me more about this.
? - as far as i read the documentation part, A question mark matches zero or one of the preceding character, please tell me why this has been used here.

and what is the mean of these symbols- \d*)$", ""), " `r`n`t")

please help me understand these symbols and tell me why they have been used here in this particular sequence. 
I will be highly obliged to you.
many many thanks to you..

I don't normally code as I don't code normally.
Shadowpheonix
Posts: 1259
Joined: 16 Apr 2015, 09:41

Re: How to remove specific values from clipboard?

29 Aug 2016, 09:58

Sabestian Caine wrote:
Shadowpheonix wrote:

Code: Select all

F1::
Clipboard := Trim(RegExReplace(Clipboard, "m)^(\d\d-\d\d-\d\d)$|^(D[^\d]?\d*)$", ""), " `r`n`t") ; This will work even if the dates change.
Return
Dear shadowpheonix...could you please make me understand why these codes have been used like this here. I tried to read the documentation part of RegExReplace but i could not understand much. i request you to make me understand few of these symbols from above codes-

Code: Select all

clipboard - is haystack i.e. whose content is to be processed, as far as i know
"m - as far as i read the documentation part "m means haystack is multi line. Please tell me more about using "m in RegExReplace command
^ - as far as i know this symbol is used to combine two statements and is used at the beginning. please elaborate this symbol 
\d\d - as far as i read the documentation part \d is used to match any single digit. but here you used three sets of \d\d i dont know why you used three sets of \d\d please tell me.
$ - this sign is used at the end of line. kindly elaborate this sign
| - i dont know about this sign
D - again you used capital D i do not know why. i think it is to remove alphanumeric values which starts from letter D. please tell me more about this.
? - as far as i read the documentation part, A question mark matches zero or one of the preceding character, please tell me why this has been used here.

and what is the mean of these symbols- \d*)$", ""), " `r`n`t")

please help me understand these symbols and tell me why they have been used here in this particular sequence. 
I will be highly obliged to you.
many many thanks to you..
Here is a breakdown of the m)^(\d\d-\d\d-\d\d)$|^(D[^\d]?\d*)$ portion of the RegEx I provided you...

When used at the very beginning of a RegEx, the ^ represents the beginning of a line.
When used at the very end of a RegEx, the $ represents the end of a line.
Together, these mean that everything in between must match the entire line.

The | character is the pipe symbol, and represents an OR condition, meaning either \d\d-\d\d-\d\d or D[\d]?\d* can match.

\d\d-\d\d-\d\d is 2 digits, a dash, 2 digits, a dash, and 2 more digits. IE: It matches 12-08-16.

In the D[\d]?\d* portion, the D is a literal value.
When used inside a RegEx (IE: not at the beginning), ^ represents a NOT condition.
The ? does indeed make the preceeding code match zero or one digit.
Together, these mean [^\d]? represents an optional single character that is NOT a digit.

D[\d]?\d* will match any line starting with D, optionally followed by a single letter, and then by an unlimited number of digits. IE: DL11318, DL2514, D12345678, and DA6 would all match.

The way I interpreted your original post, I got the impression that you had instances where the L was not always present. I guessed (perhaps incorrectly) that it could sometimes be missing completely, or could sometimes be a different single character, so I allowed for that in the RegEx.

Does that help your understanding?
sabestian cain

Re: How to remove specific values from clipboard?

30 Aug 2016, 13:30

Shadowpheonix wrote:
Sabestian Caine wrote:
Shadowpheonix wrote:

Code: Select all

F1::
Clipboard := Trim(RegExReplace(Clipboard, "m)^(\d\d-\d\d-\d\d)$|^(D[^\d]?\d*)$", ""), " `r`n`t") ; This will work even if the dates change.
Return
Dear shadowpheonix...could you please make me understand why these codes have been used like this here. I tried to read the documentation part of RegExReplace but i could not understand much. i request you to make me understand few of these symbols from above codes-

Code: Select all

clipboard - is haystack i.e. whose content is to be processed, as far as i know
"m - as far as i read the documentation part "m means haystack is multi line. Please tell me more about using "m in RegExReplace command
^ - as far as i know this symbol is used to combine two statements and is used at the beginning. please elaborate this symbol 
\d\d - as far as i read the documentation part \d is used to match any single digit. but here you used three sets of \d\d i dont know why you used three sets of \d\d please tell me.
$ - this sign is used at the end of line. kindly elaborate this sign
| - i dont know about this sign
D - again you used capital D i do not know why. i think it is to remove alphanumeric values which starts from letter D. please tell me more about this.
? - as far as i read the documentation part, A question mark matches zero or one of the preceding character, please tell me why this has been used here.

and what is the mean of these symbols- \d*)$", ""), " `r`n`t")

please help me understand these symbols and tell me why they have been used here in this particular sequence. 
I will be highly obliged to you.
many many thanks to you..
Here is a breakdown of the m)^(\d\d-\d\d-\d\d)$|^(D[^\d]?\d*)$ portion of the RegEx I provided you...

When used at the very beginning of a RegEx, the ^ represents the beginning of a line.
When used at the very end of a RegEx, the $ represents the end of a line.
Together, these mean that everything in between must match the entire line.

The | character is the pipe symbol, and represents an OR condition, meaning either \d\d-\d\d-\d\d or D[\d]?\d* can match.

\d\d-\d\d-\d\d is 2 digits, a dash, 2 digits, a dash, and 2 more digits. IE: It matches 12-08-16.

In the D[\d]?\d* portion, the D is a literal value.
When used inside a RegEx (IE: not at the beginning), ^ represents a NOT condition.
The ? does indeed make the preceeding code match zero or one digit.
Together, these mean [^\d]? represents an optional single character that is NOT a digit.

D[\d]?\d* will match any line starting with D, optionally followed by a single letter, and then by an unlimited number of digits. IE: DL11318, DL2514, D12345678, and DA6 would all match.

The way I interpreted your original post, I got the impression that you had instances where the L was not always present. I guessed (perhaps incorrectly) that it could sometimes be missing completely, or could sometimes be a different single character, so I allowed for that in the RegEx.

Does that help your understanding?

thank you very much dear Shadowpheonix. First time in life i could learn the codes so easily. I highly appreciate your way of making others understand. Really i could learn a lot from your description of codes above. thank you very much again.
Have a whale of time....
User avatar
Sabestian Caine
Posts: 528
Joined: 12 Apr 2015, 03:53

Re: How to remove specific values from clipboard?

02 Sep 2016, 13:17

Shadowpheonix wrote:
Sabestian Caine wrote:
Shadowpheonix wrote:

Code: Select all

F1::
Clipboard := Trim(RegExReplace(Clipboard, "m)^(\d\d-\d\d-\d\d)$|^(D[^\d]?\d*)$", ""), " `r`n`t") ; This will work even if the dates change.
Return
Dear shadowpheonix...could you please make me understand why these codes have been used like this here. I tried to read the documentation part of RegExReplace but i could not understand much. i request you to make me understand few of these symbols from above codes-

Code: Select all

clipboard - is haystack i.e. whose content is to be processed, as far as i know
"m - as far as i read the documentation part "m means haystack is multi line. Please tell me more about using "m in RegExReplace command
^ - as far as i know this symbol is used to combine two statements and is used at the beginning. please elaborate this symbol 
\d\d - as far as i read the documentation part \d is used to match any single digit. but here you used three sets of \d\d i dont know why you used three sets of \d\d please tell me.
$ - this sign is used at the end of line. kindly elaborate this sign
| - i dont know about this sign
D - again you used capital D i do not know why. i think it is to remove alphanumeric values which starts from letter D. please tell me more about this.
? - as far as i read the documentation part, A question mark matches zero or one of the preceding character, please tell me why this has been used here.

and what is the mean of these symbols- \d*)$", ""), " `r`n`t")

please help me understand these symbols and tell me why they have been used here in this particular sequence. 
I will be highly obliged to you.
many many thanks to you..
Here is a breakdown of the m)^(\d\d-\d\d-\d\d)$|^(D[^\d]?\d*)$ portion of the RegEx I provided you...

When used at the very beginning of a RegEx, the ^ represents the beginning of a line.
When used at the very end of a RegEx, the $ represents the end of a line.
Together, these mean that everything in between must match the entire line.

The | character is the pipe symbol, and represents an OR condition, meaning either \d\d-\d\d-\d\d or D[\d]?\d* can match.

\d\d-\d\d-\d\d is 2 digits, a dash, 2 digits, a dash, and 2 more digits. IE: It matches 12-08-16.

In the D[\d]?\d* portion, the D is a literal value.
When used inside a RegEx (IE: not at the beginning), ^ represents a NOT condition.
The ? does indeed make the preceeding code match zero or one digit.
Together, these mean [^\d]? represents an optional single character that is NOT a digit.

D[\d]?\d* will match any line starting with D, optionally followed by a single letter, and then by an unlimited number of digits. IE: DL11318, DL2514, D12345678, and DA6 would all match.

The way I interpreted your original post, I got the impression that you had instances where the L was not always present. I guessed (perhaps incorrectly) that it could sometimes be missing completely, or could sometimes be a different single character, so I allowed for that in the RegEx.

Does that help your understanding?
Thanks dear shadowpheonix for making me understand all these things in so easy way.
sir as i want to remove all the numeric digits i.e.
70,000.00
14,700.00
3,000.00
from the above series and want to keep only these values-
12-08-16
12-08-16
12-08-16
12-08-16
DL10587
DL10575
DL11318
DL2514
DL8526
DL36521
DL7485
in the clipboard then what would be the codes?
as i tried to use these codes as you told me in your description but these codes are not working. I know i am making some mistakes in these codes-

Code: Select all

f2::
Clipboard := trim(RegExReplace(Clipboard, "m)^([\d?\d*])$", ""), " `r`n`t")
msgbox % clipboard
return
one more thing i would like to ask is that if i want remove only the numeric digit which starts from 7 as in the above series 70,000.00 starts from 7. i want that all the values except 70,000.00 should remain in the clipboard then what the codes should i use. as i tried to use these codes which are also not working-

Code: Select all

f2::
Clipboard := trim(RegExReplace(Clipboard, "m)^(7[\d?\d*])$", ""), " `r`n`t")
msgbox % clipboard
return
please help me to solve these issues. I am asking these questions only for learning purpose and i hope you will help me.
thanks a lot sir...
I don't normally code as I don't code normally.
Shadowpheonix
Posts: 1259
Joined: 16 Apr 2015, 09:41

Re: How to remove specific values from clipboard?

02 Sep 2016, 17:29

Sabestian Caine wrote:Thanks dear shadowpheonix for making me understand all these things in so easy way.
sir as i want to remove all the numeric digits i.e.
70,000.00
14,700.00
3,000.00
from the above series and want to keep only these values-
12-08-16
12-08-16
12-08-16
12-08-16
DL10587
DL10575
DL11318
DL2514
DL8526
DL36521
DL7485
in the clipboard then what would be the codes?

Code: Select all

F2::
Clipboard := Trim(RegExReplace(Clipboard, "m)^(\d\d-\d\d-\d\d)$|^(D[^\d]?\d+)$|^.*$", "$1$2"), " `r`n`t")
MsgBox % clipboard
Return
Sabestian Caine wrote:one more thing i would like to ask is that if i want remove only the numeric digit which starts from 7 as in the above series 70,000.00 starts from 7. i want that all the values except 70,000.00 should remain in the clipboard then what the codes should i use.

Code: Select all

F2::
Clipboard := Trim(RegExReplace(Clipboard, "m)^(\d\d-\d\d-\d\d)$|^(D[^\d]?\d+)$|^([^7].*)$|^7.*$", "$1$2$3"), " `r`n`t")
MsgBox % clipboard
Return
In both of these, the m)^(\d\d-\d\d-\d\d)$|^(D[^\d]?\d*)$ portion is the same as it was in the original code I provided you.
However, I forgot to explain the significance of the parenthesis. In all of the code I have provided here, the parenthesis both define a group of items and tell AutoHotkey to assign whatever that group matches to a placeholder variable. The first set of parenthesis is assigned to $1, the second set to $2, the third set to $3, and so on. Any group that does not have a match will result in a placeholder variable that contains nothing.

^.*$ matches an entire line, and does not assign it to a placeholder variable (because there are no parenthesis).

"$1$2" is the replacement string, and tells AutoHotkey to replace any matches with whatever was in the first & second sets of parenthesis.

^([^7].*)$ matches any line that does not start with a 7. This is because the [ ] brackets indicate a set of allowed options. Making ^ the first character inside the brackets changes it to disallow. This means [123] will match either 1, 2, or 3, and [^123] means it can not match.
User avatar
Sabestian Caine
Posts: 528
Joined: 12 Apr 2015, 03:53

Re: How to remove specific values from clipboard?

05 Sep 2016, 11:16

Shadowpheonix wrote:
Sabestian Caine wrote:Thanks dear shadowpheonix for making me understand all these things in so easy way.
sir as i want to remove all the numeric digits i.e.
70,000.00
14,700.00
3,000.00
from the above series and want to keep only these values-
12-08-16
12-08-16
12-08-16
12-08-16
DL10587
DL10575
DL11318
DL2514
DL8526
DL36521
DL7485
in the clipboard then what would be the codes?

Code: Select all

F2::
Clipboard := Trim(RegExReplace(Clipboard, "m)^(\d\d-\d\d-\d\d)$|^(D[^\d]?\d+)$|^.*$", "$1$2"), " `r`n`t")
MsgBox % clipboard
Return
Sabestian Caine wrote:one more thing i would like to ask is that if i want remove only the numeric digit which starts from 7 as in the above series 70,000.00 starts from 7. i want that all the values except 70,000.00 should remain in the clipboard then what the codes should i use.

Code: Select all

F2::
Clipboard := Trim(RegExReplace(Clipboard, "m)^(\d\d-\d\d-\d\d)$|^(D[^\d]?\d+)$|^([^7].*)$|^7.*$", "$1$2$3"), " `r`n`t")
MsgBox % clipboard
Return
In both of these, the m)^(\d\d-\d\d-\d\d)$|^(D[^\d]?\d*)$ portion is the same as it was in the original code I provided you.
However, I forgot to explain the significance of the parenthesis. In all of the code I have provided here, the parenthesis both define a group of items and tell AutoHotkey to assign whatever that group matches to a placeholder variable. The first set of parenthesis is assigned to $1, the second set to $2, the third set to $3, and so on. Any group that does not have a match will result in a placeholder variable that contains nothing.

^.*$ matches an entire line, and does not assign it to a placeholder variable (because there are no parenthesis).

"$1$2" is the replacement string, and tells AutoHotkey to replace any matches with whatever was in the first & second sets of parenthesis.

^([^7].*)$ matches any line that does not start with a 7. This is because the [ ] brackets indicate a set of allowed options. Making ^ the first character inside the brackets changes it to disallow. This means [123] will match either 1, 2, or 3, and [^123] means it can not match.
THANKS DEAR Shadowpheonix FOR MAKING ME UNDERSTAND ALL THESE THINGS SO BEAUTIFULLY...
NOW ALMOST ALL THE THINGS ARE CLEAR IN MY MIND.....
I AM REALLY THANKFUL AND OBLIGED TO YOU AND YOUR SKILLS....
THANKS A LOT SIR....
I don't normally code as I don't code normally.
User avatar
Sabestian Caine
Posts: 528
Joined: 12 Apr 2015, 03:53

Re: How to remove specific values from clipboard?

06 Sep 2016, 13:37

Shadowpheonix wrote:
Sabestian Caine wrote:Thanks dear shadowpheonix for making me understand all these things in so easy way.
sir as i want to remove all the numeric digits i.e.
70,000.00
14,700.00
3,000.00
from the above series and want to keep only these values-
12-08-16
12-08-16
12-08-16
12-08-16
DL10587
DL10575
DL11318
DL2514
DL8526
DL36521
DL7485
in the clipboard then what would be the codes?

Code: Select all

F2::
Clipboard := Trim(RegExReplace(Clipboard, "m)^(\d\d-\d\d-\d\d)$|^(D[^\d]?\d+)$|^.*$", "$1$2"), " `r`n`t")
MsgBox % clipboard
Return
Sabestian Caine wrote:one more thing i would like to ask is that if i want remove only the numeric digit which starts from 7 as in the above series 70,000.00 starts from 7. i want that all the values except 70,000.00 should remain in the clipboard then what the codes should i use.

Code: Select all

F2::
Clipboard := Trim(RegExReplace(Clipboard, "m)^(\d\d-\d\d-\d\d)$|^(D[^\d]?\d+)$|^([^7].*)$|^7.*$", "$1$2$3"), " `r`n`t")
MsgBox % clipboard
Return
In both of these, the m)^(\d\d-\d\d-\d\d)$|^(D[^\d]?\d*)$ portion is the same as it was in the original code I provided you.
However, I forgot to explain the significance of the parenthesis. In all of the code I have provided here, the parenthesis both define a group of items and tell AutoHotkey to assign whatever that group matches to a placeholder variable. The first set of parenthesis is assigned to $1, the second set to $2, the third set to $3, and so on. Any group that does not have a match will result in a placeholder variable that contains nothing.

^.*$ matches an entire line, and does not assign it to a placeholder variable (because there are no parenthesis).

"$1$2" is the replacement string, and tells AutoHotkey to replace any matches with whatever was in the first & second sets of parenthesis.

^([^7].*)$ matches any line that does not start with a 7. This is because the [ ] brackets indicate a set of allowed options. Making ^ the first character inside the brackets changes it to disallow. This means [123] will match either 1, 2, or 3, and [^123] means it can not match.

dear shadowpheonix... i am back with one more little issue...
sir, i have a 14 digit number say 07721000012345 or 07721000005007 or 07721000000009 or 07721000000013 or 07721000000410
in the above numbers you may notice that the right sided digits- 12345, 5007, 9, 13, 410 are increasing or decreasing. on the other hand the left sided digits 077210000 are same or constant in all the numeric numbers. you may also notice that all the above five numeric numbers are containing 14 digits and zeros are increasing or decreasing to complete a number as in 07721000012345 there are 4 zeros before 1 and in 07721000005007 there is five zeros before 5. and so on. So i want that all the zeros and other digits should be removed and there should remain only right sided digits. for example if clipboard is containing 07721000012345 and i press f1 key then it should show 12345 in msgbox and if clipboard is containing 07721000000410 and i press f1 key then it should show 410 in msgbox. here is a fictitious example of codes-

Code: Select all

f1::
Clipboard:=07721000000410
Clipboard := Trim(RegExReplace(Clipboard, what would be the codes here))
msgbox % Clipboard
return
Please help me...
Thank you dear Shadowpheonix...
I don't normally code as I don't code normally.
Shadowpheonix
Posts: 1259
Joined: 16 Apr 2015, 09:41

Re: How to remove specific values from clipboard?

07 Sep 2016, 12:18

Code: Select all

f1::
Clipboard:=07721000000410
Clipboard := LTrim(Trim(RegExReplace(Clipboard, ".*(\d{5})$", "$1")), "0")
msgbox % Clipboard
return
The LTrim is used to remove the leading 0s.
.* matches an unknown number of characters.
The parenthesis define a group (as I explained previously).
\d matches a numeric digit, and {5} means "repeat 5 times", so \d{5} means match 5 digits.
User avatar
AlphaBravo
Posts: 586
Joined: 29 Sep 2013, 22:59

Re: How to remove specific values from clipboard?

07 Sep 2016, 21:06

Code: Select all

str = 07721000012345 or 07721000005007 or 07721000000009 or 07721000000013 or 07721000000410
MsgBox % RegExReplace(str, "\b077210+") "`nor`n"	; use the constant part "07721" for matching
. RegExReplace(str, "\b0*\d*?0+")					; more dynamic
Shadowpheonix
Posts: 1259
Joined: 16 Apr 2015, 09:41

Re: How to remove specific values from clipboard?

08 Sep 2016, 10:52

AlphaBravo wrote:

Code: Select all

str = 07721000012345 or 07721000005007 or 07721000000009 or 07721000000013 or 07721000000410
MsgBox % RegExReplace(str, "\b077210+") "`nor`n"	; use the constant part "07721" for matching
. RegExReplace(str, "\b0*\d*?0+")					; more dynamic
I had never thought of matching patterns that way. I like it. :)
User avatar
Sabestian Caine
Posts: 528
Joined: 12 Apr 2015, 03:53

Re: How to remove specific values from clipboard?

08 Sep 2016, 13:00

AlphaBravo wrote:

Code: Select all

str = 07721000012345 or 07721000005007 or 07721000000009 or 07721000000013 or 07721000000410
MsgBox % RegExReplace(str, "\b077210+") "`nor`n"	; use the constant part "07721" for matching
. RegExReplace(str, "\b0*\d*?0+")					; more dynamic
Thanks dear AlphaBravo for providing me more dynamic codes.
Thanks you very much sir...
I created these codes on my own with my little knowledge of ahk which are also working similar to your codes-

Code: Select all

f1::
clipboard:=07721000000410
var1:=SubStr(clipboard, 7, 10)
var2:= LTrim(var1,"0")
msgbox %var2%
Thank you sir..
I don't normally code as I don't code normally.
User avatar
Sabestian Caine
Posts: 528
Joined: 12 Apr 2015, 03:53

Re: How to remove specific values from clipboard?

08 Sep 2016, 13:02

Shadowpheonix wrote:

Code: Select all

f1::
Clipboard:=07721000000410
Clipboard := LTrim(Trim(RegExReplace(Clipboard, ".*(\d{5})$", "$1")), "0")
msgbox % Clipboard
return
The LTrim is used to remove the leading 0s.
.* matches an unknown number of characters.
The parenthesis define a group (as I explained previously).
\d matches a numeric digit, and {5} means "repeat 5 times", so \d{5} means match 5 digits.
Thanks dear Shadowpheonix....
I created these codes on my own with my little knowledge of ahk which are also working fine-

Code: Select all

f1::
clipboard:=07721000000410
var1:=SubStr(clipboard, 7, 10)
var2:= LTrim(var1,"0")
msgbox %var2%
Thank you dear shadowpheonix...
I don't normally code as I don't code normally.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: AlFlo, BPet and 116 guests