Anyone Know Regular Expressions? - Fantasy Baseball Cafe 2013

## Anyone Know Regular Expressions?

Moderator: Baseball Moderators

That's true it would. But if the regex is not working as expected .* is most likely the culprit. He's a greedy little bastard.

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
Mod in Retirement

Posts: 18800
Joined: 16 Mar 2004
Bases this season: 0
Home Cafe: Baseball
Location: in Canada, toughening up figure skaters

Amazinz wrote:That's true it would. But if the regex is not working as expected .* is most likely the culprit. He's a greedy little bastard.

Greedy little bastard?

Have you been reading the same book I have?
StlSluggers
Hall of Fame Hero

Posts: 14705
(Past Year: 109)
Joined: 24 May 2004
Bases this season: 195
Home Cafe: Baseball
Location: Parking in the gov't bldg @ 7th and Pine. It's only \$3.00 on game day!

Math humor.

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
Mod in Retirement

Posts: 18800
Joined: 16 Mar 2004
Bases this season: 0
Home Cafe: Baseball
Location: in Canada, toughening up figure skaters

Amazinz wrote:Math humor.

I guess that it's bad that got it.

I wasn't worried about the "greediness," but I'll try it with the preceeding \b just to see what I get.

I'm worried I'm double-counting because I can't verify my totals manually. In fact, my manual calculations pale in comparison to the totals I'm getting in these queries. That would be very bad, but that's a separate issue right now. First, I need to get this to a point where I'm 100% sure that I'm pulling the right crap.

Thanks for the help, A!
StlSluggers
Hall of Fame Hero

Posts: 14705
(Past Year: 109)
Joined: 24 May 2004
Bases this season: 195
Home Cafe: Baseball
Location: Parking in the gov't bldg @ 7th and Pine. It's only \$3.00 on game day!

I know some irregular expression, but I can only say them in an Australian accent
If you're a battery, you're either working or you're dead....
Coppermine
Hall of Fame Hero

Posts: 8840
Joined: 6 Sep 2005
Bases this season: 0
Home Cafe: Baseball
Location: Pennsyltucky

Is there any sort of regulation on what can proceed the CARDID portion? Instead of .* use \w* or build up a set yourself with [a-zA-Z0-9] etc. I'm pretty sure \b isn't what you want though because that would mean only strings beginning with CARDID and having the appropriate number would be matched.

Member #4 of the Inaugural Yadier Molina Fan Club!!!
SaintsOfTheDiamond
Hall of Fame Hero

Posts: 6480
Joined: 6 May 2004
Bases this season: 0
Home Cafe: Baseball
Location: Swiping second

SaintsOfTheDiamond wrote:Is there any sort of regulation on what can proceed the CARDID portion? Instead of .* use \w* or build up a set yourself with [a-zA-Z0-9] etc. I'm pretty sure \b isn't what you want though because that would mean only strings beginning with CARDID and having the appropriate number would be matched.

The preceeding stuff is based on questionnaire answers, so it's quite varied.

I did run it with /b at the beginning, and it did not pull any matches.
StlSluggers
Hall of Fame Hero

Posts: 14705
(Past Year: 109)
Joined: 24 May 2004
Bases this season: 195
Home Cafe: Baseball
Location: Parking in the gov't bldg @ 7th and Pine. It's only \$3.00 on game day!

StlSluggers wrote:
SaintsOfTheDiamond wrote:Is there any sort of regulation on what can proceed the CARDID portion? Instead of .* use \w* or build up a set yourself with [a-zA-Z0-9] etc. I'm pretty sure \b isn't what you want though because that would mean only strings beginning with CARDID and having the appropriate number would be matched.

The preceeding stuff is based on questionnaire answers, so it's quite varied.

That's what I figured. You could still narrow it down to alphanumeric, digits and a handful of special characters (properly escaped of course) couldn't you? Maybe not.

EDIT: That is, of course, if you think .* is causing the problems.

StlSluggers wrote:I did run it with /b at the beginning, and it did not pull any matches.

That's because it's \.
Last edited by SaintsOfTheDiamond on Tue May 08, 2007 2:57 pm, edited 1 time in total.

Member #4 of the Inaugural Yadier Molina Fan Club!!!
SaintsOfTheDiamond
Hall of Fame Hero

Posts: 6480
Joined: 6 May 2004
Bases this season: 0
Home Cafe: Baseball
Location: Swiping second

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?

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
Mod in Retirement

Posts: 18800
Joined: 16 Mar 2004
Bases this season: 0
Home Cafe: Baseball
Location: in Canada, toughening up figure skaters

SaintsOfTheDiamond wrote:
StlSluggers wrote:I did run it with /b at the beginning, and it did not pull any matches.

That's because it's \.

Yeah, yeah... I need to stop thinking of BBCode when I type here.

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?

Here are quite a few examples:

QuickBooks Platinum Plus for Business MasterCard,BANK--MBNA America Bank__CARDID--7
Harris MasterCard®* BusinessCard®*,BANK--Harris Trust and Savings Bank__CARDID--1
Chase Business Rebate Card,BANK--JP Morgan Chase and Co.__CARDID--11
Standard Federal MasterCard BusinessCard Card,BANK--Standard Federal Bank__CARDID--26
GM,BANK--JP Morgan Chase and Co.__CARDID--15
Continental Business MasterCard from Chase,BANK--JP Morgan Chase and Co.__CARDID--8
Platinum Plus<sup>sm</sup> Business Rewards MasterCard,BANK--MBNA America Bank__CARDID--10
<i>Platinum Plus</i>®<i>for Business</i> MasterCard,BANK--MBNA America Bank__CARDID--16
QuickBooks Platinum Plus for Business MasterCard,BANK--MBNA America Bank__CARDID--13
*Citi Professional(SM) Cash Card,BANK--Citibank__CARDID--24

What's giving me fits is that the manual sum of the data is falling short of the sum given by the regex query. I'm much more confident in the manual tally because I can pull the whole string and then parse it myself. Of course, the data stream seems to be corrupted today, so it's not like I'm going to make much progress in the verification realm today.

StlSluggers
Hall of Fame Hero

Posts: 14705
(Past Year: 109)
Joined: 24 May 2004
Bases this season: 195
Home Cafe: Baseball
Location: Parking in the gov't bldg @ 7th and Pine. It's only \$3.00 on game day!

PreviousNext

### Who is online

Users browsing this forum: Ajqpvzdw, bibihuklier, evorgomifobre, grefeatty, Irrelogoopter, Isogspousty, Jedeclucoulse, KitGogclitomo, Newshooledo, RoniLypeintit, spoimeSem, steeldstork and 6 guests

Forums Articles & Tips Sleepers Rankings Leagues

Today's Games
Tuesday, May. 21
(All times are EST, weather icons show forecast for game time)

 • NY Yankees at Baltimore(7:05 pm)
 • Detroit at Cleveland(7:05 pm)
 • Chi Cubs at Pittsburgh(7:05 pm)
 • Tampa Bay at Toronto(7:07 pm)
 • Minnesota at Atlanta(7:10 pm)