JavaScript Lingo: Regular Expressions

正则(RegExp) 并不像JS中的其他东西一样, 它有陡峭的学习曲线


Using RegExp, you can match, replace, search, and split a string, one of the more difficult types of values to manipulate.

Like with all of the other videos, we won't get into the nitty gritty, but I want to show you a few examples of where RegExp is useful.

If you wanted to create a registration page that verified passwords contained at least a number and a capital letter, you could use RegExp.

If you wanted to ensure that dates entered in a page were all valid dates in the future, you could use RegExp.

While there are limitless ways to use RegExp, many of them include validating or automatically editing information.


如其他的视频一样, 我们不会注重细节, 但是我会介绍一些正则表达式来证明它们的价值。

当你想要创建一个注册页, 验证密码需要包含至少一个数字和大写字母, 你可以使用正则

当你想要确保输入页面的日期都是未来的有效日期, 你可以使用正则。

应用正则表达式的场合没有什么限制, 大多数情况下会在验证和自动编辑数据时使用。