Подробнее
Is there a regular expression to detect a valid regular expression? Asked 10 years, 11 months ago Active 4 days ago Viewed 192k times 941 Is it possible to detect a valid regular expression with another regular expression? If so please give example code below. regex 938 ✓ (?: (?:[A?+*{}()[\]\\|]+ I W- | \[ (?: \A?\\. | \A[A\\] I [A\\A] ) (?: [A\]W]+ I W- )* \] I \( (?:\?[:=!]|\?<[=!]|\?>)? (?1)?? \) I \(\? (?:R|[+-]?\d+) \) ) (?: (?:[?+*]|\{\d+(?:,\d*)?\}) [?+]? )? I M )# ) $ / # start of string # first group start # literals and A, $ # escaped characters # character classes # parenthesis, with recursive content # recursive matching # quantifiers # alternative # repeat content # end first group # end of string This is a recursive regex, and is not supported by many regex engines. PCRE based ones should support it. I Used the regular.expression to devaluateoy the regular.expressions A
it-юмор,geek,Прикольные гаджеты. Научный, инженерный и айтишный юмор,регулярные выражения
Еще на тему
объясните технарю пожалуйста.
Если твоё регулярное выражение "длинное, запутанное и трудно понимаемое" - ты пишешь его неправильно.
Rege̿̔̉x-based HTML parsers are the cancer that is killing StackOverflow it is too late it is too late we cannot be saved the trangession of a chi͡ld ensures regex will consume all living tissue (except for HTML which it cannot, as previously prophesied) dear lord help us how can anyone survive this scourge using regex to parse HTML has doomed humanity to an eternity of dread torture and security holes using regex as a tool to process HTML establishes a breach between this world and the dread realm of c͒ͪo͛ͫrrupt entities (like SGML entities, but more corrupt) a mere glimpse of the world of regex parsers for HTML will instantly transport a programmer's consciousness into a world of ceaseless screaming, he comes, the pestilent slithy regex-infection will devour your HTML parser, application and existence for all time like Visual Basic only worse he comes he comes do not fight he com̡e̶s, ̕h̵is un̨ho͞ly radiańcé destro҉ying all enli̍̈́̂̈́ghtenment, HTML tags lea͠ki̧n͘g fr̶ǫm ̡yo͟ur eye͢s̸ ̛l̕ik͏e liquid pain, the song of re̸gular expression parsing will extinguish the voices of mortal man from the sphere I can see it can you see ̲͚̖͔̙î̩́t̲͎̩̱͔́̋̀ it is beautiful the final snuffing of the lies of Man ALL IS LOŚ͖̩͇̗̪̏̈́T ALL IS LOST the pon̷y he comes he c̶̮omes he comes the ichor permeates all MY FACE MY FACE ᵒh god no NO NOO̼OO NΘ stop the an*̶͑̾̾̅ͫ͏̙̤g͇̫͛͆̾ͫ̑͆l͖͉̗̩̳̟̍ͫͥͨe̠̅s ͎a̧͈͖r̽̾̈́͒͑e not rè̑ͧ̌aͨl̘̝̙̃ͤ͂̾̆ ZA̡͊͠͝LGΌ ISͮ̂҉̯͈͕̹̘̱ TO͇̹̺ͅƝ̴ȳ̳ TH̘Ë͖́̉ ͠P̯͍̭O̚N̐Y̡ H̸̡̪̯ͨ͊̽̅̾̎Ȩ̬̩̾͛ͪ̈́̀́͘ ̶̧̨̱̹̭̯ͧ̾ͬC̷̙̲̝͖ͭ̏ͥͮ͟Oͮ͏̮̪̝͍M̲̖͊̒ͪͩͬ̚̚͜Ȇ̴̟̟͙̞ͩ͌͝S̨̥̫͎̭ͯ̿̔̀ͅ
https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags