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 7025569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:59:30+00:00 2026-05-27T23:59:30+00:00

I have a ROR app and I would like a little help regarding parsing

  • 0

I have a ROR app and I would like a little help regarding parsing in Ruby. I have a field that accepts embed code from vimeo. The issue is that the standard code includes and <iframe> in addition to <p> elements. I would like to know if there is a quick way to remove the keep the <iframe> code while stripping out the code following the <p> element.

For example: Here is the code supplied by vidmeo <iframe src="http://player.vimeo.com/video/28638402?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff" width="400" height="170" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe><p><a href="http://vimeo.com/28638402">Youth Lagoon - Montana</a> from <a href="http://vimeo.com/tylertwilliams">Tyler T Williams</a> on <a href="http://vimeo.com">Vimeo</a>.</p>

I would like to strip out the code following the

elements, and be left with the following:

<iframe src="http://player.vimeo.com/video/28638402?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff" width="400" height="170" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>

Is there a function in ruby, not as complicated as a regex parse, that would allow assist me ? Or is parsing my best bet? I would appreciate you feedback, and any help you can provide. Thank you very much for your time and help!

  • 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-05-27T23:59:31+00:00Added an answer on May 27, 2026 at 11:59 pm

    I’d recommend that you use an HTML parser such as Nokogiri. Something simple like this:

    html   = '<iframe ...>...</p>'
    doc    = Nokogiri::HTML(html)
    iframe = doc.at_css('iframe').to_html
    

    Simple, reliable, and easily quick enough.

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

Sidebar

Related Questions

I have a RoR application (ruby v1.8.7; rails v2.3.5) that is caching a page
I am new to RoR, any help would be greatly appreciated :) I have
In my RoR app, I have a query that could return anywhere 0 to
I have recently designed a web application that I would like to write in
I have a RoR web app that I'm trying to serve up with Passenger
I have recently moved my RoR app on the Heroku platform, and almost everything
i have an RoR application Log, which similar to the book store app, my
I currently have an RoR app in production across four application servers with independent
I have a RoR app running rails 2.3.8 which makes use of the Rails
I have a small ruby application that I made on my local machine. It

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.