How to match “any character” in regular expression?

前端 未结 11 654
忘了有多久
忘了有多久 2020-11-27 09:23

The following should be matched:

AAA123
ABCDEFGH123
XXXX123

can I do: \".*123\" ?

11条回答
  •  再見小時候
    2020-11-27 10:16

    Yes, you can. That should work.

    • . = any char except newline
    • \. = the actual dot character
    • .? = .{0,1} = match any char except newline zero or one times
    • .* = .{0,} = match any char except newline zero or more times
    • .+ = .{1,} = match any char except newline one or more times

提交回复
热议问题