Regular Expressions, HTML5 new elements, and html5 New Elements
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 the face of the powerful tag attributes of HTML5, we don't have to learn javascript before we can RegEx again, because the pattern of the HTML5 input tag can implement tag verification, it will replace complex javascript with regular expression verification forms 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 sets this text as required, otherwise, you will be prompted to enter the information when submitting the form.
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.
The modifier cannot be set because it is a regular expression. In w3c, the modifier must be omitted if pattern is a regular expression rather than a string, therefore, it cannot set this modifier, rather than making 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.
The above is the regular expression and HTML5 new elements introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave a message and the editor will reply to you in time. Thank you very much for your support for the help House website!