<div dir="ltr"><div><div>Hi All,<br><br></div>I've taken a look at that bug. And also had taken a look at the mUrlRegExp inside the PostWidget.cpp file.<br><br><br></div><div>I am not good at RegExps so I thought to jump and ask the guys in Freenode's #regexp about a good regular expression, that matches this case and doesn't append the trailing character to the url.<br>
<br>Thankfully, someone has told me a working one that fixes this bug you can test it in the following link<br><br><a href="http://regex101.com/r/iT2dA3">http://regex101.com/r/iT2dA3</a><br><br></div><div>I know it is very different from the one inside the PostWidget.cpp . But I thought in modifying to suit Choqok's case.<br>
<br></div><div>First I need to convert this regexp from PHPs implementation of PCRE to Qt's QRegExp<br><br>I tried using this RegExp but it didnt match any URL <br><br>const QRegExp PostWidget::mUrlRegExp("\b(?:(?:https?|ftp|file)://|(www|ftp)\\.)[-A-Z0-9+&@#//%?=~_|$!:,.;]*[-A-Z0-9+&@#//%=~_|$]| \<br>
 \"(?:(?:https?|ftp|file)://|(www|ftp)\\.)[^\"\r\n]+\"|\"(?:(?:https?|ftp|file)://|(www|ftp)\\.)[^\"\r\n]+\"| \<br>  '(?:(?:https?|ftp|file)://|(www|ftp)\\.)[^'\r\n]+'", Qt::CaseInsensitive);<br>
<br></div><div>So If someone please could guide me to convert this regexp to QRegExp's format as it would be much appreciated.<br><br></div><div>To understand the RegExp in the above link. It contains three alternations<br>
<br>1- \b(?:(?:https?|ftp|file):\/\/|(www|ftp)\.)[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[-A-Z0-9+&@#\/%=~_|$]<br><br></div><div>Matches any url without any trailing characters<br><br>2- "(?:(?:https?|ftp|file):\/\/|(www|ftp)\.)[^"\r\n]+"|"(?:(?:https?|ftp|file):\/\/|(www|ftp)\.)[^"\r\n]+"<br>
<br></div><div>Matches any URLs surrounded by double quotation marks<br><br>3- '(?:(?:https?|ftp|file):\/\/|(www|ftp)\.)[^'\r\n]+'<br><br></div><div>Matches URL surrounded by single quotes.<br><br><br></div><div>
Finally, If I said something wrong please correct me, Also any suggestions would be much appreciated!<br><br><br></div><div>Cheers<br><br></div><div><br></div></div>