<div dir="ltr">This isn't really a PyQt question. You can do all that in basic Python, but it can help if you have something like the pyarabic library. With that you can strip out the vocalization before comparing strings. You also need to consider all the possible Alefs like in str1 you have Alef with Wasla, but str2 only has Alef. pyarabic can also help there with araby.ALEFAT which is a list of all possible Alefs with marks. You need to manually check that because Alef with Wasla has no Unicode decomposition and the wasla isn't encoded as a separate mark. There have been Unicode proposals for that, but nothing has happened so far. Anyway, I did a quick little test with your strings...<div><div><div><br></div><div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">import re</div></div><div>from pyarabic import araby</div><div>str3_nomarks = araby.separate(str3)[0] # strips all diacritics<br></div><div>for c in araby.ALEFAT: # replace any Alef with a mark by base Alef</div><div> str3_nomarks = str3_nomarks.replace(c, araby.ALEF)</div><div><br></div><div>re.findall(str2, str3_nomarks)</div><div><br></div><div>Something like that will get you matches, but if you need to track the position in a string you'll have to do some more work since dropping the diacritics will throw off the index. </div><div><br></div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 22, 2018 at 12:43 AM, Maziar Parsijani <span dir="ltr"><<a href="mailto:maziar.parsijani@gmail.com" target="_blank">maziar.parsijani@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div>Hi<br></div>I have some Arabic strings in mt database now I want to if I search like this :<br> <br></div> str1 = "ٱلْمُفْلِحُونَ"<br></div> str2 = "المفلحون"<br></div>as you can see str1 is the same as str2 but in Arabic text str1 has more alphabetical characters.<br></div>Is there anyway to search str2 but I could find both of them in a string like :<br></div> str3 = " المفلحون ٱلْمُفْلِحُونَ ٱلنَّاسُ المفلحون ٱلْمُفْلِحُونَ المفلحون ٱلنَّاسُ المفلحون ٱلنَّاسُ "</div>
<br>______________________________<wbr>_________________<br>
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
<a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" rel="noreferrer" target="_blank">https://www.<wbr>riverbankcomputing.com/<wbr>mailman/listinfo/pyqt</a><br></blockquote></div><br></div>