T
Theresa
I think this is close, but I don't quite understand this well enough
to build the expression I need to build. It is something I ran across
in existing code, need to modify, but have had no prior experience
doing. I found and have been using the following documentation to
help me experiment. http://support.alphasoftware.com/alphafivehelp/Xbasic/Overview_of_Regular_Expressions_marketing.htm
Here's the senario...
Let’s say I have the following input strings:
"ACCT Gold-P4 Mainframe - Germany Europe/Middle"
"ACCT Gold-P1 Unix-AIX-Linux - France Europe/Middle"
"ACCT Silver-P4 Database Infra Support client system - Germany Europe/
Middle"
I want to grab the portion of the string beginning after the P1/P4 and
ending with “ – “. More specifically, I need to grab:
"Mainframe"
"Unix-AIX-Linux"
"Database Infra Support client system"
(There are thousands of other potential values, but these 3
demonstrate the basic diversity I could expect.)
This is how I parsed everything up to and including P4/P1 (no problems
with this part):
"[^ ]* [^-]*-[^ ]*…
But being new at this, I am unable to come up with a parsing
expression that successfully grabs those 3 different phrase
possibilities. This is the closest I've come (though I've tried many
other possibilities):
"[^ ]* [^-]*-[^ ]* ([^(?: - )*]*)(?: - )*.*"
Note: The “(?: - )” portion is using “non-marking parenthesis” so that
it doesn’t spit out another sub-expression. Is that necessary? I'm
not sure, I just know it didn't work if I used parenthesis that
weren't non-marking. But, this returns:
“Mainframe” great!
“Unix-AIX-Linux” great!
“Database” BAD!!! Truncates value "Database Infra Support
client system"
I have tinkered and tinkered, but without a thorough understanding of
the expression parsing syntax (the documentation tells what but not
why - and the "why" of it all is important for me to grasp it fully),
I'm unable to complete the parsing expression properly.
Any help would be greatly appreciated,
Theresa
to build the expression I need to build. It is something I ran across
in existing code, need to modify, but have had no prior experience
doing. I found and have been using the following documentation to
help me experiment. http://support.alphasoftware.com/alphafivehelp/Xbasic/Overview_of_Regular_Expressions_marketing.htm
Here's the senario...
Let’s say I have the following input strings:
"ACCT Gold-P4 Mainframe - Germany Europe/Middle"
"ACCT Gold-P1 Unix-AIX-Linux - France Europe/Middle"
"ACCT Silver-P4 Database Infra Support client system - Germany Europe/
Middle"
I want to grab the portion of the string beginning after the P1/P4 and
ending with “ – “. More specifically, I need to grab:
"Mainframe"
"Unix-AIX-Linux"
"Database Infra Support client system"
(There are thousands of other potential values, but these 3
demonstrate the basic diversity I could expect.)
This is how I parsed everything up to and including P4/P1 (no problems
with this part):
"[^ ]* [^-]*-[^ ]*…
But being new at this, I am unable to come up with a parsing
expression that successfully grabs those 3 different phrase
possibilities. This is the closest I've come (though I've tried many
other possibilities):
"[^ ]* [^-]*-[^ ]* ([^(?: - )*]*)(?: - )*.*"
Note: The “(?: - )” portion is using “non-marking parenthesis” so that
it doesn’t spit out another sub-expression. Is that necessary? I'm
not sure, I just know it didn't work if I used parenthesis that
weren't non-marking. But, this returns:
“Mainframe” great!
“Unix-AIX-Linux” great!
“Database” BAD!!! Truncates value "Database Infra Support
client system"
I have tinkered and tinkered, but without a thorough understanding of
the expression parsing syntax (the documentation tells what but not
why - and the "why" of it all is important for me to grasp it fully),
I'm unable to complete the parsing expression properly.
Any help would be greatly appreciated,
Theresa