tags:

views:

34

answers:

2

Hello,

I have sentences like :

"      a"
"a    "
"      a         "

I would like to catch all this examples (with lex), but I don't how to say the beginning of the line

+1  A: 

I'm not totally sure what exactly you're looking for, but the regex symbol to specify matching the beginning of a line in a lex definition is the caret:

^
msbmsb
A: 

If I understand correctly, you're trying to pull the "a" out as the token, but you don't want to grab any of the whitespace? If this is the case, then you just need something like the following:

[\n\t\r ]+ {
  // do nothing
}

"a" {
  assignYYText( yylval );
  return aToken;
}
AwesomeJosh