Amazinz wrote:How is the data you are parsing formatted? For instance, if there are line breaks in the string .* won't match correctly depending on the regex implementation. Could it be something like that?
I never thought of that. Throwing in a [^\n\t] (plus whatever other control characters are screwing it up) should fix that, right?
EDIT: I'm assuming that one that wrapped to a new line was due to my crappy screen resolution and it isn't that way in the data file, correct? Because I don't even want to try to deal with it if a record can span multiple lines.
Try it without the wildcard like this: CARDID\-\-(5340|26|)\b
I just used that on the data you provided and it worked fine.
Edit: Scratch that. It didn't work. I'm bleary-eyed right now. I don't know what I was looking at.
Last edited by Amazinz on Tue May 08, 2007 3:19 pm, edited 1 time in total.
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
Amazinz wrote:How is the data you are parsing formatted? For instance, if there are line breaks in the string .* won't match correctly depending on the regex implementation. Could it be something like that?
I never thought of that. Throwing in a [^\n\t] (plus whatever other control characters are screwing it up) should fix that, right?
Yeah there is also a flag that can be set so that the wildcard matches line break characters. I don't know off hand how to set the flag in Perl.
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
Amazinz wrote:Try it without the wildcard like this: CARDID\-\-(5340|26|)\b
I just used that on the data you provided and it worked fine.
Edit: Scratch that. It didn't work. I'm bleary-eyed right now. I don't know what I was looking at.
It did work. It pulled the same results, though.
Here.. CARDID\-\-(\d+)
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
Amazinz wrote:Try it without the wildcard like this: CARDID\-\-(5340|26|)\b
I just used that on the data you provided and it worked fine.
Edit: Scratch that. It didn't work. I'm bleary-eyed right now. I don't know what I was looking at.
It did work. It pulled the same results, though.
What is the extra | for? Using it like this CARDID\-\-(5340|26) I pulled up one match from the data sample you provided. That seems right, no?
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
Amazinz wrote:Try it without the wildcard like this: CARDID\-\-(5340|26|)\b
I just used that on the data you provided and it worked fine.
Edit: Scratch that. It didn't work. I'm bleary-eyed right now. I don't know what I was looking at.
It did work. It pulled the same results, though.
What is the extra | for? Using it like this CARDID\-\-(5340|26) I pulled up one match from the data sample you provided. That seems right, no?
When I wrote that code, I did it in Excel. I probably just didn't format that part correctly. I'll remove it to see if it matters. Your results were correct based on what I posted.
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