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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:21:38+00:00 2026-06-01T16:21:38+00:00

I am reading one file using Ruby and I am able to filter out

  • 0

I am reading one file using Ruby and I am able to filter out strings stored in fixed sized formats. But I want to filter variable size string which is left by me in the end using some regex or some other thing.

Right now I am scanning string with following line

s.scan(/(.{4})(.{4})(.{4})(.{4})(.{4})(.{4})(.{4})(.{4})(.{4})(.*)/).each do |f,g,h,i,j,k,l,m,n,p| 

but still want to filter this (. *) part of string by separating null terminated strings from it.
How can I do this?

  • 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-01T16:21:40+00:00Added an answer on June 1, 2026 at 4:21 pm

    I don’t really understand why your regex is the way it is, but \0 is a null byte used in the regex (or \x00 if you prefer hex codes). Basically:

    "foo\x00bar".split(?\x00)
    => ["foo", "bar"]
    
    "foo\x00bar" =~ /\0/
    => 3
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading one file using ruby in which I have written regexp in
I'm having problems reading this one JPEG file using ImageIO.read(File file) - it throws
I have one process who's reading from a file (using file.read() ) and one
I'm reading in a text file using BinaryReader, then doing what I want with
I am reading an Excel file using xlrd . In one column I have
I am reading one property file which contains some file paths using shell script.
Hey all. I'm reading from one sql-format file to another, and two bytes in
I was reading some switch statements and noticed one using endswitch; . Why or
I'm reading sector-aligned chunks from a file using ReadFileEx (opened with CreateFile and the
I have a CSV file that I want to read with Ruby and create

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.