This applet can convert HTML controls into Web controls. For example, you can replace <input name = "A"> with <asp: textbox id = "A" runat = "server"> </ASP: textbox>
It was written at noon.
<! Doctype HTML public "-// W3C // dtd html 4.0 transitional // en">
<HTML>
<Head>
<Title> A small regular expression </title>
<Meta name = "generator" content = "editplus">
<Meta name = "author" content = "frog prince">
<Meta name = "keywords" content = "">
<Meta name = "Description" content = "">
<Script language = "VBScript">
Function Change ()
S = Document. All ("txt1"). Value
Dim RegEx, retval 'to create a variable.
Set RegEx = new Regexp 'to create a regular expression.
RegEx. pattern = "(<input )(.*?) (Name = )(.*?) (>) "'Set mode.
RegEx. ignorecase = true' is case insensitive.
RegEx. Global = true' sets the full nature.
Retval = RegEx. test (s.
If retval then
Msgbox ("find one or more matches ")
Else
Msgbox ("not found ")
End if
Document. all ("txt2 "). value = RegEx. replace (S, "<asp: textbox $2 id = $4 runat =" "server"> </ASP: textbox> ")
End Function
</SCRIPT>
<Script language = "JavaScript">
<! --
Function C (){
Document. All ["txt2"]. value = Document. All ["txt1"]. value. Replace (/(<input )(.*?) (Name = )(.*?) (>)/Ig, "<asp: textbox $2 id = $4 runat =/" server/"> </ASP: textbox> ");
}
// -->
</SCRIPT>
</Head>
<Body>
<P>
<Textarea name = "txt1" Cols = "50" rows = "5" id = "txt1"> </textarea>
</P>
<P>
<Textarea name = "txt2" Cols = "50" rows = "5" id = "TXT"> </textarea>
<Br>
</P>
<Input type = "button" name = "Submit" value = "" Language = "VBScript" onclick = "Change () "> <input type =" button "name =" Submit "value =" convert "Language =" JavaScript "onclick =" C () ">
<P> & nbsp; </P>
</Body>
</Html>