Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Sunshine And March Vibes (2025 Wallpapers Edition)

      June 2, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      June 2, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      June 2, 2025

      How To Prevent WordPress SQL Injection Attacks

      June 2, 2025

      How Red Hat just quietly, radically transformed enterprise server Linux

      June 2, 2025

      OpenAI wants ChatGPT to be your ‘super assistant’ – what that means

      June 2, 2025

      The best Linux VPNs of 2025: Expert tested and reviewed

      June 2, 2025

      One of my favorite gaming PCs is 60% off right now

      June 2, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      `document.currentScript` is more useful than I thought.

      June 2, 2025
      Recent

      `document.currentScript` is more useful than I thought.

      June 2, 2025

      Adobe Sensei and GenAI in Practice for Enterprise CMS

      June 2, 2025

      Over The Air Updates for React Native Apps

      June 2, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      You can now open ChatGPT on Windows 11 with Win+C (if you change the Settings)

      June 2, 2025
      Recent

      You can now open ChatGPT on Windows 11 with Win+C (if you change the Settings)

      June 2, 2025

      Microsoft says Copilot can use location to change Outlook’s UI on Android

      June 2, 2025

      TempoMail — Command Line Temporary Email in Linux

      June 2, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Automating verification of text file contents format?

    Automating verification of text file contents format?

    February 13, 2025
    01FILENO00012 CRD        20250212015407CRD TEXTFIL1 DAT INTERNALD & NUMBER1              00320250211                                            |
    

    This is one record/line in my text file. I am trying to verify if the format of file is correct.
    Now, the record should have exact number of whitespaces and some words never change.

    Now, “01FILENO000012”, “CRD” , “TEXTFILE1” are static and never change … so i want to match these exactly in brackets?

    /           System.out.println("Length of line is: " + line.length() + " " + line);
                if (line.startsWith("01") && line.trim().matches(
                        "(01FILENO00012)\s+(CRD)\s{8}[0-9]{14}(CRD)\s+(TEXTFIL1)\s+(DAT)\s+(INTERNALD)\s+(&)\s+(NUMBER1)\s{14}[0-9]{11}\s{44}[|]")) {
                    {
                        System.out.println("This is header record: " + line + " and its has correct format");
                    }
    

    Please help me write correct Java regex so that i can automate file format verification?

    Source: Read More

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleCodeSOD: Double Checking
    Next Article What is shakeout testing?

    Related Posts

    Development

    A Beginner’s Guide to Graphs — From Google Maps to Chessboards

    June 2, 2025
    Development

    How to Code Linked Lists with TypeScript: A Handbook for Developers

    June 2, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    DoorDash, our Able@ ERG celebrates National Disability Employment Awareness Month 2024

    Development

    6 Best Free and Open Source Text-Based Mastodon Clients

    Development

    Microsoft enhances Windows 11’s File Explorer with a new Shared Content Area

    Operating Systems

    Windows 11 will abandon another system app, remove Dev Home in a future release

    Operating Systems
    Hostinger

    Highlights

    Development

    The Power and Promise of Healthcare Segmentation

    June 21, 2024

    The saying “one size fits all,” absolutely does not apply to the healthcare industry. Consumers…

    Gemini 2.5: Our most intelligent AI model

    May 27, 2025

    Gh0st RAT Trojan Targets Chinese Windows Users via Fake Chrome Site

    July 29, 2024

    CVE-2025-27007 – Brainstorm Force SureTriggers Privilege Escalation Vulnerability

    May 1, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.