Regex for remove everything after “_” in all anchor Tag [closed]












-2















I want any regex to remove everything after underscore in all anchor Tag e.g



input: <a href="/category_592">Text</a>



Output <a href="/category">Text</a>










share|improve this question













closed as too broad by Wiktor Stribiżew, blhsing, Alejandro, Rob, Toto Nov 21 '18 at 18:02


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.



















  • This problem is not a good fit for regex. Have you considered parsing the text as HTML instead and then altering the value of all a tags' href attribute?

    – Daniel Farrell
    Nov 21 '18 at 17:02
















-2















I want any regex to remove everything after underscore in all anchor Tag e.g



input: <a href="/category_592">Text</a>



Output <a href="/category">Text</a>










share|improve this question













closed as too broad by Wiktor Stribiżew, blhsing, Alejandro, Rob, Toto Nov 21 '18 at 18:02


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.



















  • This problem is not a good fit for regex. Have you considered parsing the text as HTML instead and then altering the value of all a tags' href attribute?

    – Daniel Farrell
    Nov 21 '18 at 17:02














-2












-2








-2








I want any regex to remove everything after underscore in all anchor Tag e.g



input: <a href="/category_592">Text</a>



Output <a href="/category">Text</a>










share|improve this question














I want any regex to remove everything after underscore in all anchor Tag e.g



input: <a href="/category_592">Text</a>



Output <a href="/category">Text</a>







regex string notepad++






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 21 '18 at 16:59









engg.Furqanengg.Furqan

61




61




closed as too broad by Wiktor Stribiżew, blhsing, Alejandro, Rob, Toto Nov 21 '18 at 18:02


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









closed as too broad by Wiktor Stribiżew, blhsing, Alejandro, Rob, Toto Nov 21 '18 at 18:02


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.















  • This problem is not a good fit for regex. Have you considered parsing the text as HTML instead and then altering the value of all a tags' href attribute?

    – Daniel Farrell
    Nov 21 '18 at 17:02



















  • This problem is not a good fit for regex. Have you considered parsing the text as HTML instead and then altering the value of all a tags' href attribute?

    – Daniel Farrell
    Nov 21 '18 at 17:02

















This problem is not a good fit for regex. Have you considered parsing the text as HTML instead and then altering the value of all a tags' href attribute?

– Daniel Farrell
Nov 21 '18 at 17:02





This problem is not a good fit for regex. Have you considered parsing the text as HTML instead and then altering the value of all a tags' href attribute?

– Daniel Farrell
Nov 21 '18 at 17:02












1 Answer
1






active

oldest

votes


















0














Although you should avoid parsing HTML with regex, but since this is a case of anchor tag which won't be nested, hence you can do a quick work using regex. Use this regex to match the data in group1 and group2,



(<as+[^>]*?href=["'][^']*?)_.*?(["'])


and replace it with 12 (or $1$2 as per the language)



Check the demo



You haven't mentioned how should the data be replaced in case there are multiple underscores in the href attribute, so for now I have done it in a way where it replaces everything from first occurrence of underscore but you can easily do it for last occurrence of underscore by making the regex as greedy.






share|improve this answer


























  • Thank you very much @pushpesh but this regex work but only first anchor tag, not every one.

    – engg.Furqan
    Nov 21 '18 at 17:41













  • @engg.Furqan: Updated the regex and now it will match with any number of tags. Let me know if you further have any queries.

    – Pushpesh Kumar Rajwanshi
    Nov 21 '18 at 18:17






  • 1





    Really thanks @pushpesh now solved.

    – engg.Furqan
    Nov 21 '18 at 18:34











  • Happy to help Furqan :)

    – Pushpesh Kumar Rajwanshi
    Nov 21 '18 at 18:38











  • Appreciated <3 @pushpesh now I am trying to make regex change uppercase to lowercase in anchor tag like input <a href="/CategoRy_592">Text</a> Output <a href="/category_592">Text</a> I am trying find <a(w*)</a> replase to l$1 can you help me to rectify this. Thanks in advanse

    – engg.Furqan
    Nov 21 '18 at 18:49


















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Although you should avoid parsing HTML with regex, but since this is a case of anchor tag which won't be nested, hence you can do a quick work using regex. Use this regex to match the data in group1 and group2,



(<as+[^>]*?href=["'][^']*?)_.*?(["'])


and replace it with 12 (or $1$2 as per the language)



Check the demo



You haven't mentioned how should the data be replaced in case there are multiple underscores in the href attribute, so for now I have done it in a way where it replaces everything from first occurrence of underscore but you can easily do it for last occurrence of underscore by making the regex as greedy.






share|improve this answer


























  • Thank you very much @pushpesh but this regex work but only first anchor tag, not every one.

    – engg.Furqan
    Nov 21 '18 at 17:41













  • @engg.Furqan: Updated the regex and now it will match with any number of tags. Let me know if you further have any queries.

    – Pushpesh Kumar Rajwanshi
    Nov 21 '18 at 18:17






  • 1





    Really thanks @pushpesh now solved.

    – engg.Furqan
    Nov 21 '18 at 18:34











  • Happy to help Furqan :)

    – Pushpesh Kumar Rajwanshi
    Nov 21 '18 at 18:38











  • Appreciated <3 @pushpesh now I am trying to make regex change uppercase to lowercase in anchor tag like input <a href="/CategoRy_592">Text</a> Output <a href="/category_592">Text</a> I am trying find <a(w*)</a> replase to l$1 can you help me to rectify this. Thanks in advanse

    – engg.Furqan
    Nov 21 '18 at 18:49
















0














Although you should avoid parsing HTML with regex, but since this is a case of anchor tag which won't be nested, hence you can do a quick work using regex. Use this regex to match the data in group1 and group2,



(<as+[^>]*?href=["'][^']*?)_.*?(["'])


and replace it with 12 (or $1$2 as per the language)



Check the demo



You haven't mentioned how should the data be replaced in case there are multiple underscores in the href attribute, so for now I have done it in a way where it replaces everything from first occurrence of underscore but you can easily do it for last occurrence of underscore by making the regex as greedy.






share|improve this answer


























  • Thank you very much @pushpesh but this regex work but only first anchor tag, not every one.

    – engg.Furqan
    Nov 21 '18 at 17:41













  • @engg.Furqan: Updated the regex and now it will match with any number of tags. Let me know if you further have any queries.

    – Pushpesh Kumar Rajwanshi
    Nov 21 '18 at 18:17






  • 1





    Really thanks @pushpesh now solved.

    – engg.Furqan
    Nov 21 '18 at 18:34











  • Happy to help Furqan :)

    – Pushpesh Kumar Rajwanshi
    Nov 21 '18 at 18:38











  • Appreciated <3 @pushpesh now I am trying to make regex change uppercase to lowercase in anchor tag like input <a href="/CategoRy_592">Text</a> Output <a href="/category_592">Text</a> I am trying find <a(w*)</a> replase to l$1 can you help me to rectify this. Thanks in advanse

    – engg.Furqan
    Nov 21 '18 at 18:49














0












0








0







Although you should avoid parsing HTML with regex, but since this is a case of anchor tag which won't be nested, hence you can do a quick work using regex. Use this regex to match the data in group1 and group2,



(<as+[^>]*?href=["'][^']*?)_.*?(["'])


and replace it with 12 (or $1$2 as per the language)



Check the demo



You haven't mentioned how should the data be replaced in case there are multiple underscores in the href attribute, so for now I have done it in a way where it replaces everything from first occurrence of underscore but you can easily do it for last occurrence of underscore by making the regex as greedy.






share|improve this answer















Although you should avoid parsing HTML with regex, but since this is a case of anchor tag which won't be nested, hence you can do a quick work using regex. Use this regex to match the data in group1 and group2,



(<as+[^>]*?href=["'][^']*?)_.*?(["'])


and replace it with 12 (or $1$2 as per the language)



Check the demo



You haven't mentioned how should the data be replaced in case there are multiple underscores in the href attribute, so for now I have done it in a way where it replaces everything from first occurrence of underscore but you can easily do it for last occurrence of underscore by making the regex as greedy.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 21 '18 at 18:16

























answered Nov 21 '18 at 17:15









Pushpesh Kumar RajwanshiPushpesh Kumar Rajwanshi

10.9k21230




10.9k21230













  • Thank you very much @pushpesh but this regex work but only first anchor tag, not every one.

    – engg.Furqan
    Nov 21 '18 at 17:41













  • @engg.Furqan: Updated the regex and now it will match with any number of tags. Let me know if you further have any queries.

    – Pushpesh Kumar Rajwanshi
    Nov 21 '18 at 18:17






  • 1





    Really thanks @pushpesh now solved.

    – engg.Furqan
    Nov 21 '18 at 18:34











  • Happy to help Furqan :)

    – Pushpesh Kumar Rajwanshi
    Nov 21 '18 at 18:38











  • Appreciated <3 @pushpesh now I am trying to make regex change uppercase to lowercase in anchor tag like input <a href="/CategoRy_592">Text</a> Output <a href="/category_592">Text</a> I am trying find <a(w*)</a> replase to l$1 can you help me to rectify this. Thanks in advanse

    – engg.Furqan
    Nov 21 '18 at 18:49



















  • Thank you very much @pushpesh but this regex work but only first anchor tag, not every one.

    – engg.Furqan
    Nov 21 '18 at 17:41













  • @engg.Furqan: Updated the regex and now it will match with any number of tags. Let me know if you further have any queries.

    – Pushpesh Kumar Rajwanshi
    Nov 21 '18 at 18:17






  • 1





    Really thanks @pushpesh now solved.

    – engg.Furqan
    Nov 21 '18 at 18:34











  • Happy to help Furqan :)

    – Pushpesh Kumar Rajwanshi
    Nov 21 '18 at 18:38











  • Appreciated <3 @pushpesh now I am trying to make regex change uppercase to lowercase in anchor tag like input <a href="/CategoRy_592">Text</a> Output <a href="/category_592">Text</a> I am trying find <a(w*)</a> replase to l$1 can you help me to rectify this. Thanks in advanse

    – engg.Furqan
    Nov 21 '18 at 18:49

















Thank you very much @pushpesh but this regex work but only first anchor tag, not every one.

– engg.Furqan
Nov 21 '18 at 17:41







Thank you very much @pushpesh but this regex work but only first anchor tag, not every one.

– engg.Furqan
Nov 21 '18 at 17:41















@engg.Furqan: Updated the regex and now it will match with any number of tags. Let me know if you further have any queries.

– Pushpesh Kumar Rajwanshi
Nov 21 '18 at 18:17





@engg.Furqan: Updated the regex and now it will match with any number of tags. Let me know if you further have any queries.

– Pushpesh Kumar Rajwanshi
Nov 21 '18 at 18:17




1




1





Really thanks @pushpesh now solved.

– engg.Furqan
Nov 21 '18 at 18:34





Really thanks @pushpesh now solved.

– engg.Furqan
Nov 21 '18 at 18:34













Happy to help Furqan :)

– Pushpesh Kumar Rajwanshi
Nov 21 '18 at 18:38





Happy to help Furqan :)

– Pushpesh Kumar Rajwanshi
Nov 21 '18 at 18:38













Appreciated <3 @pushpesh now I am trying to make regex change uppercase to lowercase in anchor tag like input <a href="/CategoRy_592">Text</a> Output <a href="/category_592">Text</a> I am trying find <a(w*)</a> replase to l$1 can you help me to rectify this. Thanks in advanse

– engg.Furqan
Nov 21 '18 at 18:49





Appreciated <3 @pushpesh now I am trying to make regex change uppercase to lowercase in anchor tag like input <a href="/CategoRy_592">Text</a> Output <a href="/category_592">Text</a> I am trying find <a(w*)</a> replase to l$1 can you help me to rectify this. Thanks in advanse

– engg.Furqan
Nov 21 '18 at 18:49





Popular posts from this blog

鏡平學校

ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

Why https connections are so slow when debugging (stepping over) in Java?