-1
some_language_built-in_function(String,'^(?:([^,]*)\,?){1}',1)

I am new to regular expression. I know this pattern is to extract some specfic context. Can anyone elaborate this? I have few questions:
1) the first "^"
2) "?"
3) ":"
4) "\" Is this "\" to escape ","? If so, why? I can't related these with normal regular expression.

Here is the first line of csv file (to be extract).

aardsda01,2004,1,SFN,NL,11,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11
Hanamichi
  • 177
  • 1
  • 5

1 Answers1

3
  • ^: start of line
  • (?:....): non-capturing group (as opposed to (....), capturing group)
  • \,: equivalent to , (\ is indeed unneccesary)

Thus: start of line (^), then exactly one ((?:....){1}) of: any number of non-commas ([^,]*) captured in the first group ((....)), and an optional comma (,?).

Amadan
  • 169,219
  • 18
  • 195
  • 256