Thread: How to remove all text insides all script and style tags

  1. #1
    Registered User
    Join Date
    Oct 2018
    Posts
    30

    How to remove all text insides all script and style tags

    The title says it all. Since following suggestions and studying laserlight code and Googling like crazy since last week, I can now modify C code design for terminal to work for files input/output I understand C functions and define (macros). Hopefully, I’ll be talking the talk of text-processing with C by New Year. I can now:

    1) Remove all occurrences of a WORD from a FILE in C
    2) Remove all occurrences of a CHAR from a FILE in C
    3) Replace all occurrences of a WORD in a FILE
    4) Replace all occurrences of a CHAR in a FILE
    5) Remove all EMPLY LINES from a FILE
    6) Remove all EMPLY SPACE from a FILE


    But my tool-box still seems empty. I need help with three other things. This one may solve my problem with the other few:

    How to remove all the text between all script and style tags and anything else with-in my HTML file that is on my HDD for manipulation?


    Any help would be greatly appreciated.


    Have a Great day!

  2. #2
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,106
    Is this a homework assignment, a product you are designing, or a tool to do some other work?

    We don't program your homework. You have to start the code and we can advise.

    Otherwise, it sounds like you want "Work for hire" for free, and that's not going to happen here either!

    Can you give us more.information?

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    For each tag you want to remove, you'll want to read-and-copy until you see the start tag, then just read until you see the close tag, then start read-and-copying again.

    You're starting to build yourself an actual parser here; have you considered looking at what's already available there?

  4. #4
    Registered User
    Join Date
    Oct 2018
    Posts
    30
    Rstanley, no offence but since the invention of INTERNET, from universities to coding forums, people have been sharing code long before you crawled out your diapers. If you need my biography, you’ll find it in one of my previous two threads.

    I might be a college drop-out but I know how to word my questions to not to be questioned. Other then that I’m a lover. Like Hulk Hogan, I just want to wrap these pythons around you. heehee Just kidding.

    Might as well have some fun since you don't want to talk shop.

  5. #5
    Registered User
    Join Date
    Oct 2018
    Posts
    30
    tabstop, you hit the nail on the head about the C Parser. That is why I been trying to learn C since September 2018. It was like yesterday when I read about the weak points of the C parser. I don't need all of that. I prefer build something like it to do only what I need amd that's all.

    I was near completion of my personal project using perl. I stop and said I might as well use this time to learn C because these perl modules are teaching me nothing. What Mojo can’t do, TreeBuilder will, then vice-versa to the point of insanity. I rather learn a little bit of C after all of that.

    To show my advancement and dedication since joining this forum I listed all the additional features that I added to correspond with laserlight layout and I learn so much behind that, but not everything. I did not reinvent the wheel but I know enough and have spend my time testing to make sure that what I have will NEVER fail. That is what I do best.

    I would have posted but I never seen anyone post his entire project. Years ago I did that once at masm32 and they love it but my best friends there said I should have not done that. Might as well tell the whole story ... The principal is in the MAC and others today.

    If I were to post it, it would have to be a team effort to build upon and not just an simple example.

    Anyway, I had been working on a solution to my own questions for over three days as I went to no avail. I even tried to use system(sed -) inside the C code to get the job done. I’ll try to play it by ear as you suggested tonight. Maybe I’m a genus and don’t know it yet.
    .
    Last edited by fat32; 11-12-2018 at 09:05 PM.

  6. #6
    Registered User
    Join Date
    Oct 2018
    Posts
    30
    tabstop, It took a minute, now I see your point. I had been doing it along until I started lining up the code and realized that it did not complete the job as expected. In the back of my mind I thought I done it already. After 20 hours back to back for three days I was brain dead, even while posting the question. I had three of them. Hopefully I will post the solution by tomorrow night

    Thanks for the wake-up call

    Good night

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to remove text within parentheses in C ?
    By apple.c in forum C Programming
    Replies: 1
    Last Post: 08-03-2018, 03:34 AM
  2. Remove data from text file
    By beon in forum C++ Programming
    Replies: 2
    Last Post: 05-17-2007, 08:53 PM
  3. CODE Tags script bug
    By Mario F. in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 10-15-2006, 02:18 PM
  4. C++ style 'zelda' text
    By swgh in forum C++ Programming
    Replies: 3
    Last Post: 04-28-2006, 04:37 AM
  5. Remove text from external file....
    By Unregistered in forum C++ Programming
    Replies: 3
    Last Post: 03-18-2002, 05:49 PM

Tags for this Thread