Works like a charm! I tested thoroughly with a hard return in various places and they ALL return exactly what I was looking for. A thousand thanks, a thousand times over...
Would it be too much to ask to explain what those additional characters mean?
Fabrice Lambert
My best advice will be to look at an online regex tester site, such as https://regexr.com/
Everything is explained there (and much better than I will ever do).
Opps...I spoke too soon. It is grabbing everything after the escaped "//" (\/\/). I want the pattern match to stop after it finds it...
Fabrice Lambert
Guess in its actual form, the regex isn't precise enough.
You'll need to provide more details about the message's structure, so we can write a more accurate regex.
John Clark
ASKER
Sure thing, and thanks for sticking with this.
The complete message can look like this:
FM SOMBODY
TO SOMEBODY ELSE
REF/A/SOME OBSCURE BOOK//
MSGID/CASREP/DDG 123/123//
CASUALTY/INITIAL-17051/STBD FIN STAB OVERHEATS/EIC:TR00000/CAT:2//
1. THE PROBLEM IS THIS
//
THE END
The pattern you provided grabs returns:
CASUALTY/INITIAL-17051/STBD FIN STAB OVERHEATS/EIC:TR00000/CAT:2//
1. THE PROBLEM IS THIS
//
THE END
What I want is:
CASUALTY/INITIAL-17051/STBD FIN STAB OVERHEATS/EIC:TR00000/CAT:2
After a quick analysis in the part you want to extract, it looks like you have:
the word CASUALTY (is that always the case ?)
followed by a slash
followed by the word INITIAL (is that always the case ?)
followed by a minus
followed by 5 numbers
followed by a slash
followed by a description (anything that isn't a slash ?)
followed by a slash
followed by 3 letters (always EIC ?)
followed by a semi-colon
followed by 2 letters (always TR ?)
followed by 5 numbers
followed by a slash
followed by 3 letters (always CAT ?)
followed by a semi-colon
followed by a number
followed by 2 slash
There are some parts wich I'm still unsure about, please let me know if I'm right, or provide a correction.
John Clark
ASKER
Not quite that complicated. There are really two constants here: the string "CASUALTY/" and the next "//" it encounters. I am looking for everything between (including any VbCrLf which was causing the problem) them. More specifically, I want a string that starts with "CASUALTY/" and all the elements before, but not including the "//".
For the record,I use the resulting string as a slash ("/") delimited array for populating an Access table.
Would it be too much to ask to explain what those additional characters mean?