castarco,
@castarco@hachyderm.io avatar

@barubary

Sure. What follows is a dumb example ( executed in https://regex101.com/ ), but illustrates my point.

In this particular case you could say that ? is semantically required for <script> because we could have more than one, but many times we don't have this distinction and it still affects how many steps the has to perform.

(Sorry for having the text selected in the 2nd image, I was copying it for the alt of the images 😅 )

[Result: 1 match, 75 steps, 0.0ms Regexp (with the ? symbol): /([sS]*?)</script>/gi

Text:

<main> Hello World <script>console.log("hello!"); More stuff Just a decoy!](https://media.hachyderm.io/media_attachments/files/111/914/833/409/432/020/original/3925f50f868f8a82.png)
  • All
  • Subscribed
  • Moderated
  • Favorites
  • til
  • ngwrru68w68
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • anitta
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • provamag3
  • tester
  • Leos
  • megavids
  • JUstTest
  • All magazines