Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9145883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:37:25+00:00 2026-06-17T10:37:25+00:00

I am parsing one file which has some html tag and changing into latex

  • 0

I am parsing one file which has some html tag and changing into latex tag.

cat text

  <Text>A &lt;strong&gt;ASDFF&lt;/strong&gt; is a &lt;em&gt;cerebrovafdfasfscular&lt;/em&gt; condifasdftion caufadfsed fasdfby tfdashe l
 ocfsdafalised &lt;span style="text-decoration: underline;"&gt;ballooning&lt;/span&gt; or difdaslation of an arfdatery in thdfe bfdasrai
 n. Smadfsall aasdneurysms may dadisplay fdasno ofadsbvious sdfasigns (&lt;span style="text-decoration: underline;"&gt;&lt;em&gt;&lt;str
 ong&gt;asymptomatic&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;) bfdasut lfdsaarger afdasneurysms maydas besda asfdsasociated widfth sdsfudd

  sed -e 's|&lt;strong&gt;\(.*\)&lt;/strong&gt;|\\textbf{\1}|g' test

cat out

 <Text>A \textbf{ASDFF&lt;/strong&gt; is a &lt;em&gt;cerebrovafdfasfscular&lt;/em&gt;    condifasdftion caufadfsed fasdfby tfdashe locfsda
    falised &lt;span style="text-decoration: underline;"&gt;ballooning&lt;/span&gt; or    difdaslation of an arfdatery in thdfe bfdasrain. Sma
      dfsall aasdneurysms may dadisplay fdasno ofadsbvious sdfasigns (&lt;span style="text-decoration: underline;"&gt;&lt;em&gt;&lt;strong&gt
      ;asymptomatic}&lt;/em&gt;&lt;/span&gt;) bfdasut lfdsaarger afdasneurysms maydas besda   asfdsasociated widfth sdsfudd

Expected outputs should be \textbf{ASDFF} while i observe \textbf{ASDFF ………}. How to get expected result?

Regards

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T10:37:27+00:00Added an answer on June 17, 2026 at 10:37 am

    You may want to use perl regex instead.

    perl -pe  's|&lt;strong&gt;(.*?)&lt;/strong&gt;|\\textbf{\1}|g'
    

    Your problem is similar with non-greedy-regex-matching-in-sed. And next time you may want to simplify your case to point out the real problem. For example, don’t just paste the raw html code, use this instead:

    fooTEXT1barfooTEXT2bar
    

    Update

    If you just want the greedy approach, just ignore this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am parsing one file which has almost 1 billion(or may be trillion) records.
Question abstract: how to parse text file into two hashes in Perl. One store
I'm parsing a template using linux command line using pipes which has some 1-indexed
I am parsing an xml file. One of the method is below : public
I'm working in C#/.NET and I'm parsing a file to check if one line
I'm reading this introductory book on parsing (which is pretty good btw) and one
I am parsing an XML file where one of the fields I want to
I have an application with a file and folder list control which supports Drag&Drop
I am parsing a file which contains both strings and numerical values. I'd like
my code is parsing some lines in a log file. i do many things

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.