Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I have regex that work on web page with browser via JavaScript...
But in Android it dont work...

Hee is JavaScript code:
JavaScript
document.getElementsByTagName('html')[0].innerHTML =document.getElementsByTagName('html')[0].innerHTML.replace(new RegExp('\\bOrdu\\b','g'),"<i style='background-color:#1446B0;color:white;'>ordu</i>");



Java(Android) code that is not work
"document.getElementsByTagName('html')[0].innerHTML =" +
"document.getElementsByTagName('html')[0].innerHTML." +
"replace(new RegExp(\"\\bOrdu\\b\",\"g\"),\"<i style=\\'background-color:#1446B0;color:white;\\'>ordu</i>\");");


where am I wrong? My mind frezzed!
Posted
Updated 14-Nov-15 9:47am
v3

1 solution

I am not an Android user. But something comes to mind.
It a known fact that regex exist in many flavors: are you sure your regex mean the same in both cases ?

Are you sure your translation to Android is correct ?

Did you tried to use a simpler regex just to see if the problem lay only in the regex ?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900