Mike's JavaScript and AJAX

Click on this to run the regular expressions in the 2nd column of the display on the right.

The result will be displayed in the 3rd column of the display on the right.

Each time you click on the another regular expression will be executed.

Click on this to run the regular expressions in the 2nd column of the display on the right.

The result will be displayed in the 3rd column of the display on the right.

Each time you click on the another regular expression will be executed.

Click on this to run the regular expressions in the 2nd column of the display on the right.

The result will be displayed in the 3rd column of the display on the right.

Each time you click on the another regular expression will be executed.

































































































Text Regular Expression Result of change
<timecontainer> <hour24>17</hour24> <hour12>05</hour12> <minute>16</minute> <second>02</second> <centisecond>00</centisecond> <ampm>PM</ampm> </timecontainer>
replace(/.*<(hour24)>([0-9][0-9]*)<.*/,"$1=$2");
 
<timecontainer> <hour24>17</hour24> <hour12>05</hour12> <minute>16</minute> <second>02</second> <centisecond>00</centisecond> <ampm>PM</ampm> </timecontainer>
replace(/.*<(hour12)>([0-9][0-9]*)<.*/,"$1=$2");
 
<timecontainer> <hour24>17</hour24> <hour12>05</hour12> <minute>16</minute> <second>02</second> <centisecond>00</centisecond> <ampm>PM</ampm> </timecontainer>
replace(/.*<(minute)>([0-9][0-9]*)<.*/,"$1=$2");
 
<timecontainer> <hour24>17</hour24> <hour12>05</hour12> <minute>16</minute> <second>02</second> <centisecond>00</centisecond> <ampm>PM</ampm> </timecontainer>
replace(/.*<(second)>([0-9][0-9]*)<.*/,"$1=$2");
 
<timecontainer> <hour24>17</hour24> <hour12>05</hour12> <minute>16</minute> <second>02</second> <centisecond>00</centisecond> <ampm>PM</ampm> </timecontainer>
replace(/.*<(centisecond)>([0-9][0-9]*)<.*/,"$1=$2");
 
<timecontainer> <hour24>17</hour24> <hour12>05</hour12> <minute>16</minute> <second>02</second> <centisecond>00</centisecond> <ampm>PM</ampm> </timecontainer>
replace(/.*<(ampm)>([ampAMP]*)<.*/,"$1=$2");
 
<timecontainer> <hour24>17</hour24> <hour12>05</hour12> <minute>16</minute> <second>02</second> <centisecond>00</centisecond> <ampm>PM</ampm> </timecontainer>
replace(/.*<(ampm)>([AMP]*)<.*/i,"$1=$2");
 
<timecontainer> <hour24>17</hour24> <hour12>05</hour12> <minute>16</minute> <second>02</second> <centisecond>00</centisecond> <ampm>PM</ampm> </timecontainer>
replace(/.*<(ampm)>([amp]*)<.*/i,"$1=$2");
 
This code removed the <tags>

<timecontainer> <hour24>17</hour24> <hour12>05</hour12> <minute>16</minute> <second>02</second> <centisecond>00</centisecond> <ampm>PM</ampm> </timecontainer>

replace(/<[^<>]*>/g,"\n");
replace(/^\n*/g,"");
replace(/\n*$/g,"");
replace(/\n\n/g,"<br>");
 
This code removed the data between the <tags>

<timecontainer> <hour24>17</hour24> <hour12>05</hour12> <minute>16</minute> <second>02</second> <centisecond>00</centisecond> <ampm>PM</ampm> </timecontainer>

replace(/>[^<>]*</g,"><");
replace(/<(\/[^<>]*)>/g,"<$1>\n");
replace(/\n/g,"<br>");
replace(/>/,"><br>");
 
JavaScript split() support regular expressions. But here we just use a simple ",".

1 , 2 , 3, 4,5,6, 7, 8 , 9

split(",");
 
JavaScript split() support regular expressions. Here we use a regular expression.

1 , 2 , 3, 4,5,6, 7, 8 , 9

split(/ *, */);
 
<timecontainer> <hour24>17</hour24> <hour12>05</hour12> <minute>16</minute> <second>02</second> <centisecond>00</centisecond> <ampm>PM</ampm> </timecontainer>
match(/[a-z]/)
Do we have any lower case letters?
 
NO LOWERCASE LETTERS HERE!!!! HONEST!!!!
match(/[a-z]/)
Do we have any lower case letters?
 
<timecontainer> <hour24>17</hour24> <hour12>05</hour12> <minute>16</minute> <second>02</second> <centisecond>00</centisecond> <ampm>PM</ampm> </timecontainer>
match(/[A-Z]/)
Do we have any UPPER CASE letters?
 
no uppercase letters here!!!! honest!!!!!
match(/[A-Z]/)
Do we have any UPPER CASE letters?
 
<timecontainer> <hour24>17</hour24> <hour12>05</hour12> <minute>16</minute> <second>02</second> <centisecond>00</centisecond> <ampm>PM</ampm> </timecontainer>
match(/[0-9]/)
Do we have any numbers?
 
No numbers here!!!! Honest!!!!!
match(/[0-9]/)
Do we have any numbers?
 
<timecontainer> <hour24>17</hour24> <hour12>05</hour12> <minute>16</minute> <second>02</second> <centisecond>00</centisecond> <ampm>PM</ampm> </timecontainer>
match(/\d/)
Do we have any numbers?
 
No numbers here!!!! Honest!!!!!
match(/\d/)
Do we have any numbers?
 
<timecontainer> <hour24>17</hour24> <hour12>05</hour12> <minute>16</minute> <second>02</second> <centisecond>00</centisecond> <ampm>PM</ampm> </timecontainer>
match(/\(\d{3,3}\)\d{3,3}-\d{4,4}/);
Do we have a phone number like (nnn)nnn-nnnn?
 
(310)333-5939
match(/\(\d{3,3}\)\d{3,3}-\d{4,4}/)
Do we have a phone number like (nnn)nnn-nnnn?
 
<timecontainer> <hour24>17</hour24> <hour12>05</hour12> <minute>16</minute> <second>02</second> <centisecond>00</centisecond> <ampm>PM</ampm> </timecontainer>
match(/\d{3,3}\.\d{3,3}\.\d{4,4}/)
Do we have a phone number like nnn.nnn.nnnn?
 
310.333.5939
match(/\d{3,3}\.\d{3,3}\.\d{4,4}/)
Do we have a phone number like nnn.nnn.nnnn?
 
<timecontainer> <hour24>17</hour24> <hour12>05</hour12> <minute>16</minute> <second>02</second> <centisecond>00</centisecond> <ampm>PM</ampm> </timecontainer>
match(/(\d{3,3}\.|\(\d{3,3}\))\d{3,3}(\.|-)\d{4,4}/)
Do we have a phone number like
(nnn)-nnn-nnn or nnn.nnn.nnnn?
 
310.333.5939
match(/(\d{3,3}\.|\(\d{3,3}\))\d{3,3}(\.|-)\d{4,4}/)
Do we have a phone number like
(nnn)-nnn-nnn or nnn.nnn.nnnn?
 
(310)333-5939
match(/(\d{3,3}\.|\(\d{3,3}\))\d{3,3}(\.|-)\d{4,4}/)
Do we have a phone number like
(nnn)-nnn-nnn or nnn.nnn.nnnn?
 

Home