0

Hello everyone I have a regex pattern as follows

"disp"i VARIABLE ("attr"i stixpaths)? ("limit"i INT)?

and

I test it with

disp VARIABLE attr stixpaths limit INT

I use to test it online https://regex101.com/

But I get 0 matches though I believe it should match am I missing anything here?

Learner
  • 1,686
  • 4
  • 19
  • 38
  • What are your expectations? Why do you think it should match? Did you mean to use `disp VARIABLE (attr stixpaths)? (limit INT)?`? See [demo](https://regex101.com/r/jMrt3w/1). – Wiktor Stribiżew Jan 29 '21 at 17:28
  • @WiktorStribiżew expect this pattern match with disp VARIABLE attr stixpaths limit INT as you see i means case insisnsitive and limit and stixpaths are optional pluse VARIABLE is there so it is an exact match – Learner Jan 29 '21 at 17:32
  • So you want to apply case insensitivity to parts of regex? Like `(?i:disp) VARIABLE ((?i:attr) stixpaths)? ((?i:limit) INT)?`? See [demo](https://regex101.com/r/jMrt3w/2). – Wiktor Stribiżew Jan 29 '21 at 17:34
  • @WiktorStribiżew right. Is the above pattern not doing it? – Learner Jan 29 '21 at 17:35
  • Please check [this answer of mine](https://stackoverflow.com/a/58818125/3832970). – Wiktor Stribiżew Jan 29 '21 at 17:35
  • The problem is that you did not use proper constructs. – Wiktor Stribiżew Jan 29 '21 at 17:45
  • @WiktorStribiżew I do not following your answer fix my issue a here it is not working (i)disp VARIABLE (attr stixpaths)? (limit INT)? – Learner Jan 29 '21 at 18:01
  • See https://stackoverflow.com/questions/65959029/regex-not-working-as-a-expected-when-i-feed-disp-variable-attr-stixpaths-limit?noredirect=1#comment116620879_65959029 – Wiktor Stribiżew Jan 29 '21 at 18:01
  • actually that link works thanks a lot very helpful – Learner Jan 29 '21 at 18:02

0 Answers0