Regex Help

  • Thread starter Thread starter Fritz Switzer
  • Start date Start date
F

Fritz Switzer

I've got some strings I'd like to regex.split. Any ideas on what the
format would be for these examples. I'm webscraping so I have no control on
the inputs.

A couple points: the POS can be both single and two characters G C F SG PF
PG etc. NO can be 1 or 2 digits. The WT would always be 100-999 pounds.

NO PLAYER POS HT WT
31Booker, ChrisF6-10247
24Buckley, MelvinG6-7200
3Buscher, BrettF6-8242
32Carroll, MattF6-8233
6Jones, EddieSG6-6200
3Wade, DwyanePG6-4210


I've tried some of the online Regex Testers but I'm stumped , any help would
be appreciated.
 
Luc,

Thanks, that seems to match, but I don't see how it "splits" the string into
the string array.

for example >> 31Booker, ChrisF6-10247

results[0]="31"
results[1]="Booker"
results[2]= ,
results[3]="Chris"
results[4]="F"
results[5]="6-10"
results[6]="247"

I was hoping this was how I could use "Regex.Split" , if not, I'm open for
suggestions.

TIA,


--
Fritz

Maybe "\d\d?[A-Z][a-z]*, [A-Z][a-z]*[A-Z][A-Z]?\d-[1-9]\d\d\d"

/LM

Fritz Switzer said:
I've got some strings I'd like to regex.split. Any ideas on what the
format would be for these examples. I'm webscraping so I have no
control on the inputs.

A couple points: the POS can be both single and two characters G C
F SG PF PG etc. NO can be 1 or 2 digits. The WT would always be
100-999 pounds.

NO PLAYER POS HT WT
31Booker, ChrisF6-10247
24Buckley, MelvinG6-7200
3Buscher, BrettF6-8242
32Carroll, MattF6-8233
6Jones, EddieSG6-6200
3Wade, DwyanePG6-4210


I've tried some of the online Regex Testers but I'm stumped , any
help would be appreciated.
 
"(\d\d?)([A-Z][a-z]*), ([A-Z][a-z]*)([A-Z][A-Z]?)(\d-[1-9]\d)(\d\d\d?)"

/LM

Fritz Switzer said:
Luc,

Thanks, that seems to match, but I don't see how it "splits" the string into
the string array.

for example >> 31Booker, ChrisF6-10247

results[0]="31"
results[1]="Booker"
results[2]= ,
results[3]="Chris"
results[4]="F"
results[5]="6-10"
results[6]="247"

I was hoping this was how I could use "Regex.Split" , if not, I'm open for
suggestions.

TIA,


--
Fritz

Maybe "\d\d?[A-Z][a-z]*, [A-Z][a-z]*[A-Z][A-Z]?\d-[1-9]\d\d\d"

/LM

Fritz Switzer said:
I've got some strings I'd like to regex.split. Any ideas on what the
format would be for these examples. I'm webscraping so I have no
control on the inputs.

A couple points: the POS can be both single and two characters G C
F SG PF PG etc. NO can be 1 or 2 digits. The WT would always be
100-999 pounds.

NO PLAYER POS HT WT
31Booker, ChrisF6-10247
24Buckley, MelvinG6-7200
3Buscher, BrettF6-8242
32Carroll, MattF6-8233
6Jones, EddieSG6-6200
3Wade, DwyanePG6-4210


I've tried some of the online Regex Testers but I'm stumped , any
help would be appreciated.
 
Luc,

Thanks for all your help, I'll try that.


--
Fritz


"(\d\d?)([A-Z][a-z]*),
([A-Z][a-z]*)([A-Z][A-Z]?)(\d-[1-9]\d)(\d\d\d?)"

/LM

Fritz Switzer said:
Luc,

Thanks, that seems to match, but I don't see how it "splits" the
string into the string array.

for example >> 31Booker, ChrisF6-10247

results[0]="31"
results[1]="Booker"
results[2]= ,
results[3]="Chris"
results[4]="F"
results[5]="6-10"
results[6]="247"

I was hoping this was how I could use "Regex.Split" , if not, I'm
open for suggestions.

TIA,


--
Fritz

Maybe "\d\d?[A-Z][a-z]*, [A-Z][a-z]*[A-Z][A-Z]?\d-[1-9]\d\d\d"

/LM

I've got some strings I'd like to regex.split. Any ideas on what
the format would be for these examples. I'm webscraping so I have
no control on the inputs.

A couple points: the POS can be both single and two characters G C
F SG PF PG etc. NO can be 1 or 2 digits. The WT would always be
100-999 pounds.

NO PLAYER POS HT WT
31Booker, ChrisF6-10247
24Buckley, MelvinG6-7200
3Buscher, BrettF6-8242
32Carroll, MattF6-8233
6Jones, EddieSG6-6200
3Wade, DwyanePG6-4210


I've tried some of the online Regex Testers but I'm stumped , any
help would be appreciated.
 
Note that you wouldn't use Regex.Split() on this, you would use Regex.Match.

I'd code this as:

(? said:

3Wade, DwyanePG6-4210


--
Eric Gunnerson

Visit the C# product team at http://www.csharp.net
Eric's blog is at http://blogs.gotdotnet.com/ericgu/

This posting is provided "AS IS" with no warranties, and confers no rights.
Fritz Switzer said:
Luc,

Thanks for all your help, I'll try that.


--
Fritz


"(\d\d?)([A-Z][a-z]*),
([A-Z][a-z]*)([A-Z][A-Z]?)(\d-[1-9]\d)(\d\d\d?)"

/LM

Fritz Switzer said:
Luc,

Thanks, that seems to match, but I don't see how it "splits" the
string into the string array.

for example >> 31Booker, ChrisF6-10247

results[0]="31"
results[1]="Booker"
results[2]= ,
results[3]="Chris"
results[4]="F"
results[5]="6-10"
results[6]="247"

I was hoping this was how I could use "Regex.Split" , if not, I'm
open for suggestions.

TIA,


--
Fritz


Luc E. Mistiaen wrote:
Maybe "\d\d?[A-Z][a-z]*, [A-Z][a-z]*[A-Z][A-Z]?\d-[1-9]\d\d\d"

/LM

I've got some strings I'd like to regex.split. Any ideas on what
the format would be for these examples. I'm webscraping so I have
no control on the inputs.

A couple points: the POS can be both single and two characters G C
F SG PF PG etc. NO can be 1 or 2 digits. The WT would always be
100-999 pounds.

NO PLAYER POS HT WT
31Booker, ChrisF6-10247
24Buckley, MelvinG6-7200
3Buscher, BrettF6-8242
32Carroll, MattF6-8233
6Jones, EddieSG6-6200
3Wade, DwyanePG6-4210


I've tried some of the online Regex Testers but I'm stumped , any
help would be appreciated.
 
Back
Top