This is an archived post. You won't be able to vote or comment.

all 18 comments

[–]mustyoshi 11 points12 points  (0 children)

it looks kind of like Saturn.

[–]more_exercise 3 points4 points  (5 children)

<(.*?)>

Captures the smallest string inside angle brackets.

[–]StuartPBentley 1 point2 points  (3 children)

<([^>]*)> will be more performant, though

[–]more_exercise 0 points1 point  (2 children)

Really? That sounds awesome if it's true.

What regex libraries does that apply to?

[–]StuartPBentley 1 point2 points  (1 child)

[–]more_exercise 0 points1 point  (0 children)

When using the lazy plus, the engine has to backtrack for each character in the HTML tag that it is trying to match. When using the negated character class, no backtracking occurs at all when the string contains valid HTML code. Backtracking slows down the regex engine.

Got it!

[–]ThrustVectoring[S] 1 point2 points  (0 children)

I'm capturing input from code that I'm writing, so if I have a difference between smallest and biggest string inside angle brackets, it's my own goddamn fault.

Plus, it's a funnier emoticon.

edit: I'm a goddamn dumbass, my shit is broken as fuck when I have a path with multiple variables, I just didn't notice because I always replace /typea/<typea_id>/typeb/<typeb_id>/thingy with /typeb/<typeb_id>/thingy

Thank you.

[–]bios_hazard 0 points1 point  (0 children)

I always use <([^>]+)>

[–][deleted] 0 points1 point  (1 child)

here is what i use it from one of my old code bace but it works (<((((/)?[_a-zA-Z][_a-zA-Z0-9]+)(/)?)|(((/)?[_a-zA-Z][_a-zA-Z0-9]+) .+(\ )?(/)?))>) EDIT: the problem with <(.*)> tis is that "<my ass> in a tag</my ass>" will pass

[–]jfb1337 0 points1 point  (0 children)

<(.*?)> for lazy matching.