簡體   English   中英

為什么這個ruby正則表達式不匹配這個字符串?

[英]Why won't this ruby regex match this string?

x = "output/file.zip"

x =~ /output\/.\../

返回零。 逃避這段時間有問題,但我無法弄清楚。

. 通常在正則表達式中表示“任何字符”。 試試.* ,這意味着“重復零次或多次”: .

x =~ /output\/.*\..*/

對我來說很好。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM