Code: Select all
RegexMatch("RE: Insured Some e2D84587 Company, new E2D84589 GLPD water damage E23456789 claim in NJ, E2D84587"
, "\b(E[a-zA-Z0-9]{7})\b", out)
code := out1
matches will be in out1, out2 etc
Code: Select all
RegexMatch("RE: Insured Some e2D84587 Company, new E2D84589 GLPD water damage E23456789 claim in NJ, E2D84587"
, "\b(E[a-zA-Z0-9]{7})\b", out)
code := out1
kon wrote:Code: Select all
H := "RE: Insured Some e2D84587 Company, new E2D84589 GLPD water damage E23456789 claim in NJ, E2D84587" RegExMatch(H, "\bE[a-zA-Z0-9]{7}\b", var) MsgBox, % var ; E2D84589 MsgBox % RTrim(RegExReplace(H, "(\bE[a-zA-Z0-9]{7}\b\s?)|.+?", "$1")) ; E2D84589 E2D84587
I think you need to re-address your criteriaOlegred wrote: Thanks for the help. However, even in your example it leaves in "E23456789" which is 9 characters, not 8.
Olegred wrote:Is shorter or longer than 8 characters
Code: Select all
H := "RE: Elements Insured Some e2D84587 Company, new E2D84589 GLPD water damage E23456789 claim in NJ, E2D84587"
RegExMatch(H, "\bE[a-zA-Z0-9]{7}\b", var)
MsgBox, % var ; Elements
MsgBox % RTrim(RegExReplace(H, "(\bE[a-zA-Z0-9]{7}\b\s?)|.", "$1")) ; Elements E2D84589 E2D84587
RegExMatch(H, "\bE[A-Z0-9]{7}\b", var)
MsgBox, % var ; E2D84589
MsgBox % RTrim(RegExReplace(H, "(\bE[A-Z0-9]{7}\b\s?)|.", "$1")) ; E2D84589 E2D84587
It's basically a case of adding in/removing exclamation marks (exclamation points),Olegreddo wrote: You got all my requirements in reverse. Thanks for your code. Can you reverse it? Thanks
Code: Select all
q::
vText := "e234567 e2345678 e23456789 E234567 E2345678 E23456789"
vText .= " e_34567 e_345678 e_3456789 E_34567 E_345678 E_3456789"
vOutput := ""
VarSetCapacity(vOutput, StrLen(vText)*2)
Loop, Parse, vText, %A_Space%
{
vTemp := A_LoopField
if (SubStr(vTemp, 1, 1) == "E") ;check first letter case sensitive
if (StrLen(vTemp) = 8) ;check length
if !RegExMatch(vTemp, "[^A-Za-z0-9]") ;check for any non-alphanumeric characters
vOutput .= vTemp " "
}
vOutput := SubStr(vOutput, 1, -1)
Clipboard := vOutput
MsgBox % "done"
Return
;criteria reversed:
;if !(SubStr(vTemp, 1, 1) == "E") ;check first letter case sensitive
;if !(StrLen(vTemp) = 8) ;check length
;if RegExMatch(vTemp, "[^A-Za-z0-9]") ;check for any non-alphanumeric characters
kon wrote:Code: Select all
H := "RE: Insured Some e2D84587 Company, new E2D84589 GLPD water damage E23456789 claim in NJ, E2D84587" RegExMatch(H, "\bE[a-zA-Z0-9]{7}\b", var) MsgBox, % var ; E2D84589 MsgBox % RTrim(RegExReplace(H, "(\bE[a-zA-Z0-9]{7}\b\s?)|.+?", "$1")) ; E2D84589 E2D84587
Does the code below do what you want?Olegred wrote:.
Code: Select all
text = ggggggggggggiii--014930-BIU------------- ggor gggggggggg--018310-PC 18310-PC 8310-PC 018310-PI
text := RegExReplace(text, "\d{6}-(PC|BIU)(*SKIP)(*F)|.", "")
text := RegExReplace(text, "BIU|PC", "$0`n")
msgbox, % text
I forgoted the "\b" option! The code below is more suitable! (for example, it does not match 1234567-BIU, 1234567-PC, 123456-BIUU or 123456-PCC)Olegred wrote:Oh, my god, you are the best. It works. Magic.
Code: Select all
text = -123456-BIU- 1234567-BIU \12345678-BIU ]000000-BIT 111111-BIUU --123456-PC 1234567-PC 12345678-PC 222222-PI ==333333-PCC
text := RegExReplace(text, "\b\d{6}-(PC|BIU)\b(*SKIP)(*F)|.", "")
text := RegExReplace(text, "BIU|PC", "$0`n")
msgbox, % text
Users browsing this forum: Chunjee, Joey5, mebelantikjaya and 319 guests