Matches the regular expressions and form regular expressions of all content in the form.
The requirement is as follows:
There is now a form
Copy codeThe Code is as follows: <form action = 'mk. php'> ...... </form>
The ellipsis in the form represents the content, which has a variety of labels <>.
You want to write a regular expression to match the entire form, including the form tag, which is the content in the html file.
The first thing that comes to mind is:
Copy codeThe Code is as follows:
<Form. * </form>
In this way:
Copy codeThe Code is as follows:
<Form [^>] */form>
This is also the case:
Copy codeThe Code is as follows:
<Form. * <\/form>
As long as there are tags in the form, no content can be matched. It is inexplicable and I don't know why.
Later I consulted a regular expression expert and he told me another method:
Copy codeThe Code is as follows:
<Form [\ s \ S] * </form>
This involves the greedy mode and the non-Greedy mode.
[\ S \ S] indicates that all white spaces + non-white spaces are matched.
* It means 0 or more, and it will be stopped after it is met.
In this way, all the content in form is matched.
Note: <form [\ s \ S] * </form> is successfully verified in DW.
Match content with a regular expression
Just remove \ B. Second, I believe you will.
3rd: <form. * </form>
Help write a regular expression to extract form data. C #
Use the regular expression to retrieve the number of rows, that is, the number of rows in <table>.
<TR [^>] *> ([\ s \ S] *?) <\/TR>
The number of returned results is how many pieces of data he has, and then he uses the following regular expression to retrieve each result:
> ([^ <] *) <\/
The search result is the data you want.
Note: C # Remember to escape special characters or add the @ symbol before the string