gpt4 book ai didi

ruby-on-rails - 什么是_?在以下正则表达式中是什么意思?

转载 作者:数据小太阳 更新时间:2023-10-29 08:37:39 26 4
gpt4 key购买 nike

<分区>

_? 在下面的 rails 正则表达式中是什么意思?

/\A_?[a-z]_?(?:[a-z0-9.-]_?)*\z/i

我试图破译正则表达式如下

# regex explained
# \A : matches the beginning of the string
# _? :
# [ : beginning of character group
# a-z : any lowercase letter
# ] : end of character group
# _? :
# ( : is a capture group, anything matched within the parens is saved for later use
# ?: : non-capturing group: matches below, but doesn't store a back-ref
# [ : beginning of character group
# a-z : any lowercase letter
# A-Z : any uppercase letter
# 0-9 : any digit
# . : a fullstop or "any character" ??????
# _ : an underscore
# ] : end of character group
# _? :
# ) : See above
# * : zero or more times of the given characters
# \z : is the end of the string

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com