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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:14:51+00:00 2026-05-30T20:14:51+00:00

I have a hashes.xml on a location on the web. I want to parse

  • 0

I have a hashes.xml on a location on the web. I want to parse it for the fields name='hash'><string>78235A2449BA7188CBF95F7DD2D40A36</string>, the file has many fields with this pattern (the MD5 hash is only an example, they differ in the XML document), I want to get them all and print to stdout. As far as I get is to fetch the first occurence and print it out then I’m stuck.

for locale in (locales)
  while hash.nil? do
    headers = {
      'Host' => server,
      'Content-Type' => 'application/x-www-form-urlencoded',
      'Content-Length' => locale.length.to_s,
    }

    resp, data = http.post(path, locale, headers)

    # Extract the hash
    data =~ /name='hash'\>\<string\>([A-F0-9]+).*\<\/string\>/m
    hash = $1
    mylocale = locale
    break if hash.nil?
  end
end

if hash.nil?
  puts "ERROR"
  exit(1)
end

puts "Hash: "+hash
  • 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-30T20:14:52+00:00Added an answer on May 30, 2026 at 8:14 pm

    you are looking for the scan method:

    a =<<END
    this is some example name='hash'><string>AAAAAA224</string>
    
    name='hash'><string>AAAAAA224</string>
    vname='hash'><string>AAAAAA224</string>
    example  for you name='hash'><string>666</string>
    
    END
    
    m = a.scan(/name='hash'><string>[A-F0-9]+.*<\/string>/)
    
    puts m.inspect
    

    The result is:

    ["name='hash'><string>AAAAAA224</string>", "name='hash'><string>AAAAAA224</string>", "name='hash'><string>AAAAAA224</string>", "name='hash'><string>666</string>"]
    

    You can see this post as well.

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

Sidebar

Related Questions

I'm using XML::Simple to parse an XML file which I then want to use
I have my web config as follows <?xml version=1.0?> <configuration> <appSettings/> <connectionStrings> <add name=MySqlConnection
Right now I have two hashes. I want to assign one entire hash to
I have an array of hashes, and I want the unique values out of
I am currently learning Perl. I have Perl hash that contains references to hashes
I have a hash of hashes %signal_db . A typical element is: $signal_db{$cycle}{$key} .
My question is as follows: I have to read a big XML file, 50
I have several models with fields that are integers. I also have hashes that
I have two hashes: p = {name=>TRICHI, subdistrict=>{WANDIWASH=>1234}} q = {name=>VELLORE, subdistrict=>{WANDIWASH=>4183}} I need
I have an array of hashes. Each entry looks like this: - !map:Hashie::Mash name:

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.