c# - Regex expression is too greedy -


I am writing a regular expression to match the data from the IMDB soundtrack data file. My rezepses are mostly working, although they are in places sticking a lot of text in my named groups. For example, take the following reggae:

  "Displayed"? (? & Lt; artist & gt;; *) ('? \ (Qv \))? $ " 

In the artist group with string ' (qv) Only the name of the artist is included. Unfortunately, because records are not constantly formatted, some artists are surrounded by single quotation marks while others are not. This means that they are alternatively optional as far as regex is concerned.

Did I the last group? & Gt; Trying to mark a greedy group using the group specifier, but there was no effect on the results of the result.

I can improve the results by changing the artist group to match a small number of artists, but it reduces the possibility of parse the name correctly. Besides, if I only To remove the apostrophe character, I would not be able to parse, for example, ADI's Lonely Friends band, such as band names with apostrops, which run for their lives Damage was Resident Evil: Apocalypse .

Update: Here is an example input line, which, according to the request, must match the rags. Other formats are also presented which will not be able to handle my existing regiments. "

 " Carmen Silra "(QV)  
  var exp = new Regex (@ "I" ^ 'Performance by' '? (? Artist & gt; *?) ('? \ (Qv \))? $ " );  

Actually you need to specify non-greedy discovery on artist matching.

I will add a comment to tell why it is not good Will have enough time for your project.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -