Regular Expression and HTML5 new elements and html5 New Elements
Insert a website https://www.processon.com/
ProcessOn is an online collaborative drawing platform that provides users with the most powerful and easy-to-use plotting tools!
It can easily draw something online and let you understand it.
Regular Expression
Today's regular expressions are only simple to use to learn regular expressions. In front of the powerful HTML5 tag attributes, we
You do not need to learn javascript before RegEx.
Pattern can be used to verify tags, which replaces complex javascript expressions with regular expression verification forms.
It will be completely replaced in the future.
Simple use of regular expressions:
[0-9] search for any number from 0 to 9.
[A-z] searches for any characters from lowercase to lowercase.
[A-Z] looks for any character from uppercase A to uppercase Z.
[A-z] searches for any character from uppercase A to lowercase z.
N {X} matches the string that contains X n sequences.
N {X, Y} matches the string that contains X or Y n sequences.
N {X,} matches strings that contain at least X n sequences.
Remember that these operations can implement simple regular expressions. For example:
<Form action = "#"> <input type = "text" pattern = "[0-9a-zA-Z] {1 ,} "required> <input type =" submit "value =" submit "> </form>
This is a form verification with A simple verification range of any 0 to 9 or a to z or A to Z, and
Required indicates that this text is required. Otherwise, a prompt is displayed when the form is submitted.
To use regular expressions, remember the metacharacters, quantifiers, and square brackets.
The pattern attribute specifies the regular expression matching method, and can only be the length of the regular expression matching.
Currently, it cannot be as convenient as the javascript RegExp object. It cannot be used to set modifiers, such as global or case-sensitive settings.
However, it is very powerful.
Why can't I set a modifier because it is a regular expression, which is explained in w3cPatternIs a regular expression, not a string,
The modifier must be omitted, so it cannot set this modifier, not an error.
Supplement: Match Chinese Regular Expressions
[\ U4e00-\ u9fa5] This indeed only matches Chinese Characters
[^ \ X00-\ xff] This matches all non-ASCII characters, that is, the half-width characters in the general sense, and these % !) (And so on.
HTML5 audio and video elements
Audio tag
<Audio controls autoplay loop> <source src = "URL" type = "audio/mp4"> <source ssrc = "URL" type = "audio/ogg"> <p> you </p> </audio>
:
Its attributes:
If autoplay displays this attribute, the audio will be played immediately after it is ready.
If this attribute is displayed in controls, a control, such as a play button, is displayed to the user.
If this attribute appears in loop, playback starts again at the end of the audio.
If this attribute is displayed in preload, the audio is loaded and ready to be played during page loading. If "autoplay" is used, this attribute is ignored.
The url of the audio to be played by the src URL.
Video tags
<Video controls loop muted width = "400" height = "400" poster = "show image URL before playback"> <source src = "video Local Address URL" type = "video /mp4 "> <source src =" video Local Address URL "type =" video/ogg "> <p> not supported by your browser </p> </video>
Its attributes:
If this attribute is displayed on autoplay, the video is played immediately after it is ready.
If this attribute is displayed in controls, a control, such as a play button, is displayed to the user.
If this attribute appears in loop, the media file starts playing again after being played.
Muted specifies that the audio output of the video should be muted.
The poster URL specifies the image displayed when the video is downloaded, or the image displayed before the user clicks the play button.
If this attribute is displayed in preload, the video is loaded and ready to be played during page loading. If "autoplay" is used, this attribute is ignored.
The url of the video to be played.
Width pixels: Specifies the width of the video player.
Height pixels sets the height of the video player.
They all have three formats: mp4, ogg, and webm. Currently, the supported formats are not complete.