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

  • Home
  • SEARCH
  • 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 8312863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:18:09+00:00 2026-06-08T20:18:09+00:00

In my project I have to parse a set of dynamic strings which contains

  • 0

In my project I have to parse a set of dynamic strings which contains numbers, date, other info marion. I tried writing a parser with regular expression. It’s working but not all time. Can someone suggest a better solution for this? Below is a sample string

“Thank you for using your HDFC Bank Debit/ATM Card ending 4444 for Rs.
125.25 towards ATM WDL in T NAGAR CAP at ATM on 2012-04-16:17:33:03.”

here I want data like

bank name =hdfc
card no =4444
amount = 125.25
category = atm 
date = 2012-04-16:17:33:03
  • 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-08T20:18:10+00:00Added an answer on June 8, 2026 at 8:18 pm

    Solving this just with regular expressions, especially when the exact content of the String is dynamic, won’t work very well. What you need is a tokenizer and a lexical analyzer with a grammar. I haven’t done something like this in Java, but first of all you need to break down your string into tokens (keywords, values, expressions, phrases etc.)
    like

    “Thank you for using your HDFC Bank Debit/ATM Card ending 4444 for Rs. 125.25 towards ATM WDL in T NAGAR CAP at ATM on 2012-04-16:17:33:03.”

    phrase[Thank you for using your] 
    stringconst[HDFC Bank]
    phrase[ending]
    numericconst[4444]
    keyword[for]
    stringconst[Rs.]
    numericconst[125.25]
    ....
    

    You can do so by defining tokens, give them convinient names and defining rules for them i.e. with regular expressions. The focus is on what you have, not what it means
    Afterwards you need a gramer as regular expressions won’t help you understand the ‘what’:

    sentence  ::= intro bankinfo cardinfo valueinfo categoryinfo timeinfo
    intro     ::= phrase
    bankinfo  ::= bankname phrase | phrase bankname
    bankname  ::= stringconst
    ....
    

    Which basically gives you a tree of rules.

    By tokenizing your input string and applying you grammar, you should be able to analyze the string and find the parts that are of interest.

    Unfortunately this is only an theoretical introduction to this quiet complex but very interesting topic and I cannot provide any code examples, but I hope this helps to get started.

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

Sidebar

Related Questions

in my C#-project, I have a class which contains a List public class MyClass
I have project Emle in Launchpad . I set it to import from emle.svn.sourceforge.net
I have set up jqGrid with JSON in my .Net MVC project. The grid
I have tried to integrate paypal sandbox with my project in asp.net. Redirection to
I have a project where a user needs to define a set of instructions
Good Morning All! I have been developing a project for some time in which
I have a VB.net project which uses a background worker to do some stuff.
I have a small Qt4 project which I want to build with cmake. It
In a .Net project in which I'm using NHibernate, I have a piece of
I have an ActionScript project set up using the Flash Builder IDE. Using the

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.