为什么WebSocket而不是Socket?(why WebSocket rather than Socket? [closed])
Java Applet支持套接字,但限制了与已从中下载applet的http服务器的连接。
为什么要创建WebSocket抽象来从Javascript / HTML 5发送数据? 不可能在JS中添加对“经典”套接字的支持并限制连接(就像Java Applets一样)
Java Applets support socket but limits the connection towards the http server from which the applet has been downloaded.
Why a WebSocket abstraction has been created for sending data from Javascript/HTML 5 ? Wouldn't have been possible to add support for a “classical” socket in JS and limit the connection (as it has been done for Java Applets)
原文:https://stackoverflow.com/questions/26267253
更新时间:2023-04-15 11:04
最满意答案
- 您在输入中缺少结束锚
$
- 字符类中的
Az
也会匹配不需要的字符,你实际上需要AZ
{0,1}
可以缩短为?
试试这个正则表达式:
/^[0-9]{2}-[0-9]{2,3}[a-zA-Z]?$/
- You are missing end anchor
$
in your inputA-z
inside character class will match unwanted characters as well, you actually needA-Z
{0,1}
can be shortened to?
Try this regex:
/^[0-9]{2}-[0-9]{2,3}[a-zA-Z]?$/
相关问答
更多-
这是完成这项工作的一种方式: $strs = array('^hello world^', 'my ^hello world^'); foreach($strs as $str) { echo $str, preg_match('/^\^.*\^$/', $str) ? "\tmatch\n" : "\tdoesn't match\n"; } 输出: ^hello world^ match my ^hello world^ doesn't match Here is a way ...
-
您在输入中缺少结束锚$ 字符类中的Az也会匹配不需要的字符,你实际上需要AZ {0,1}可以缩短为? 试试这个正则表达式: /^[0-9]{2}-[0-9]{2,3}[a-zA-Z]?$/ RegEx演示 You are missing end anchor $ in your input A-z inside character class will match unwanted characters as well, you actually need A-Z {0,1} can be shorten ...
-
这将完成工作: ^(([A-Z])\2)-\d{2}-(?:(?!\1)[A-Z]){2}-\1$ This will do the job: ^(([A-Z])\2)-\d{2}-(?:(?!\1)[A-Z]){2}-\1$
-
正则表达式的问题在于\D可以是除数字之外的任何内容 ,因此它将错误地匹配该位置中具有特殊字符的字符串,并且无法匹配具有多个数字组的字符串。 相反,尝试^[0-9a-zA-Z]*[0-9][0-9a-zA-Z]*$ 。 这将匹配任意数量的数字或字母,后跟数字,以及任意数量的数字或字母。 这是一个演示 ...... The problem with your regex is that \D can be anything except a number, so it will wrongly match st ...
-
你可以利用负向前瞻。 例如, >>> re.findall(r'-(?!aa|bb)([^-]+)', string) ['a', 'bc', 'def', 'ghij'] -比赛- (?!aa|bb)负向前瞻,检查-是否-后面没有aa或bb ([^-]+)匹配除了以外的ony或更多字符- 编辑 上面的正则表达式与那些以aa或bb开头的正则表达式不匹配,例如-aabc- 。 为了照顾我们可以添加-像前面这样的, >>> re.findall(r'-(?!aa-|bb-)([^-]+)', string) ...
-
SQL小提琴 Oracle 11g R2架构设置 : 查询1 : WITH DATA AS ( SELECT 'Vdsl 1.10.4' AS str FROM DUAL ) SELECT SUBSTR( REGEXP_SUBSTR( str, '\.\d+', 1, 1 ), 2 ) AS FIRST_NUMBER, SUBSTR( REGEXP_SUBSTR( str, '\.\d+', 1, 2 ), 2 ) AS SECOND_NUMBER FROM DATA 结果 ...
-
*和+之间有一个区别。 你放*之后的角色可以没有重复。 但在+情况下,它可以有至少1次重复。 在A* | (A*BA*BA*)* A* | (A*BA*BA*)* , BBAABB有以下原因并且符合(A*BA*BA*)*模式 A*开头没有A BA*为1 B而没有A BA*和BA* 1B *在(A*BA*BA*)*显示图案可以重复。 所以第二次重复是BB ,这是有效的 这些是BBAABB有效的点。 There is one difference between * and +. The character a ...
-
这个怎么样: base64:([^\] \b]*) 这是一个regex101示例: https://regex101.com/r/2qRBV7/2 抓住每个不是的字符, 和\b(=word boundry)之后的\b(=word boundry) base64: How about this one: base64:([^\] \b]*) Here is a regex101 example: https://regex101.com/r/2qRBV7/2 Catch every char that i ...
-
听起来很简单: .*\+.*\+.* .*匹配any_string,直到\+匹配“+”符号。 It sounds as simple as: .*\+.*\+.* the .* matches any_string until the \+ matches a "+" symbol.
-
它不匹配,因为\w+要求至少有1个字符在10和percent之间。 用* ( 零次或多次出现 )替换+ ( 一次 或多次出现 ): (^(?:[\d\.]+|first|second|goal))(?:\w*(interval|percent))? ^ 它会工作。 查看正则表达式演示 It does not get matched because \w+ requires at least 1 word char between 1 ...