Reputation:
p = "<a href=\".*?\"\\stitle=\"(.*?\")>.*?<\/a><span class=\"event-nodetype\">\((.*?\)</span><span class=\"event-timeleft\">\()(.*?\)<\/span><li>)";
This is regex i created for
<a href="/bu/?q=node/775" title="YOK ED?LEN MEDEN?YET: GEÇ OSMANLI VE ERKEN CUMHUR?YET DÖNEMLER?NDE GAYR?MÜSL?M VARLI?I">YOK ED?LEN MEDEN?YET: GEÇ OSMANLI VE ERKEN CUMHUR?YET DÖNEMLER?NDE GAYR?MÜSL?M VARLI?I</a><span class="event-nodetype">(Konferans / Kongre / Sempozyum)</span><span class="event-timeleft">(Devam etmekte)</span><li>
But eclipse gives error of
Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )
I put \
to "
and other things but still i cant fix it.
What is the problem?
When i split the line into 4 lines
p = "<a href=\".*?\"\\stitle=\"(.*?\")>"
+ ".*?<\/a><span class=\"event-nodetype\">\(("
+ ".*?\)</span><span class=\"event-timeleft\">\()("
+ ".*?\)<\/span><li>)";
the error seems on line 2.
Upvotes: 0
Views: 36
Reputation: 75272
\"
is correct, an so is \\s
(but I would use \\s+
). All the other backslashes in your regex need to be escaped: \\/
, \\(
, \\)
(/
doesn't need escaping, but doing so doesn't hurt anything). This is for the string literal, not for the regex; the backslash is an escape character for both.
Upvotes: 1