Search the Community
Showing results for tags 'regexp'.
-
/* Merry Christmas everyone! */ I have an array of objects: arr = [ obj1, obj2 ]; Each object has prototypes: obj1.txt = "az"; obj2.txt = "abc"; obj1.isRoot = false; obj2.isRoot = false; And there's an array called dictionary, it formed like this: var dictionary = [ ["a","(n)"], ["ab","(n)"], ["abc","(n)"], ["abcd","(n)"] ] What I try to achieve is when obj.txt is similar to dictionary[x][0], then obj.isRoot turn to TRUE. I've made the function below so far but it doesn't work. function go(){ for ( i=0; i<arr.length; i++ ){ txt_source = arr[
-
Hello, I'm trying to hide/show table rows using RegExp. And I don't know why I have to create RegExp for each row. This is my script: <!DOCTYPE html><html><body> <table border="1"><tr><td name="c1">row1 col1</td><td name="c2">row1 col2</td></tr><tr><td name="c1">row2 col1</td><td name="c2">row2 col2</td></tr><tr><td name="c1">row3 col1</td><td name="c2">row3 col2</td></tr><tr><td name="c1">row4 col1</td><td name="c2">row4 col2</td>
-
I want to extract Have tried:str.match(/[\W]*Lib4[\W]*/); but return nothing. How can I take it out with JavaScript Regular Expression?
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title><script>str = "This is an apple.";function searching(query){document.getElementById("findings").innerHTML = str.replace(/query/gi,"<span style='color: red'>"+query+"</span>");}</script></head><body><div id="text"><script>document.write(str)</