My regular expressions are a bit rusty, and Perl even worse, but just off the top of my head "|" means bitwise "or" doesn't it?
What are you getting when you run it? What are you trying to get it to do? I'll poke around with it and see what I can come up with when I get home ... after I re-teach myself Perl first.
You do know that when you write Perl scripts only you and God know what it means today and tomorrow, only one of you knows, and it ain't you.
SaintsOfTheDiamond wrote:My regular expressions are a bit rusty, and Perl even worse, but just off the top of my head "|" means bitwise "or" doesn't it?
What are you getting when you run it? What are you trying to get it to do? I'll poke around with it and see what I can come up with when I get home ... after I re-teach myself Perl first.
You do know that when you write Perl scripts only you and God know what it means today and tomorrow, only one of you knows, and it ain't you.
I have a long string with a particular segment I'm interested in. Here's an example:
The CARDID can be assigned to more than one card name (preceeding text), so my expression needs to identify all strings that contain CARDID--14. Just to make it fun, more than one CARDID exists for each card depending on the issuing bank, so I have to add multiple CARDIDs into one result. But fun isn't enough. The original values in the CARDID XML sheet were changed by some schmuck back in January without my permission and knowledge. They changed everything from a 4-digit value to a sequential values starting at the number 1. Of course, that means I have to write a query that can pull exactly the value CARDID--1 and not CARDID--10 or CARDID--11 and so forth. Friggin' morons...
Anyways, here's an example of a query I wrote to meet all of the above criteria:
.*CARDID\-\-(3561|3562|9|14)\b
So I don't care what comes before the CARDID portion of the string (.*). The CARDID is literal, and the \-\- portion of the string completes the CARDID-- segment of the query. That part's pretty simple. The parenthetical stuff is where I think the problem is at. This query should be pulling exactly these four values:
CARDID--3561
CARDID--3562
CARDID--9
CARDID--14
I don't want it pulling CARDID--4092 because it has a 9 in it (just as an example).
I'm not really sure what you mean by "equals" or "includes". That regex will match 5340 OR 26 exactly but included in the larger expression.
Edit: Yes it's working that way.
Maine has a good swing for a pitcher but on anything that moves, he has no chance. And if it's a fastball, it has to be up in the zone. Basically, the pitcher has to hit his bat. - Mike Pelfrey
I'm not really sure what you mean by "equals" or "includes". That regex will match 5340 OR 26 exactly but included in the larger expression.
That's what I'm shooting for. If CARDID--26 exists, I don't have to worry about it including CARDID--126, right? Do I have to worry about it including CARDID--260?
StlSluggers wrote:Do I have to worry about it including CARDID--260?
You do not because of \b which is setting a boundary.
And wouldn't it be
\bCARDID\-\-(3561|3562|9|14)\b
rather than
.*CARDID\-\-(3561|3562|9|14)\b
Maine has a good swing for a pitcher but on anything that moves, he has no chance. And if it's a fastball, it has to be up in the zone. Basically, the pitcher has to hit his bat. - Mike Pelfrey
StlSluggers wrote:Do I have to worry about it including CARDID--260?
You do not because of \b which is setting a boundary.
And wouldn't it be
\bCARDID\-\-(3561|3562|9|14)\b
rather than
.*CARDID\-\-(3561|3562|9|14)\b
I didn't think I wanted to include the \b at the beginning because I thought that would essentially tell it to look for a string that began with CARDID.