Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
R_varma8309059731
Contributor
Contributor

My input string format is ''24-OCT-23 05.22.45.513000000 AM GMT' and I want to Reject otherthan this pattern

My input string format is ''24-OCT-23 05.22.45.513000000 AM GMT' and I want to Reject otherthan this pattern and saving in a oracle table.

How we can filter this and reject wrong formats in the input values :

for example 1: ''24-OCT-23 05.22.45.513000000'

for example 2: ''24-OCT-23 05.22.45.513000000 AM'

Labels (4)
1 Reply
Anonymous
Not applicable

Hi

You can create an routine function to check the date pattern using regex expression, call the routine function on tFilterRow to filter the rows.

eg:

  public static boolean checkDatePattern(String str)

  {

   boolean isDate=false;

   String datePattern ="\\d{2}-\\w{3}-\\d{2} \\d{2}.\\d{2}.\\d{2}.\\d{9} \\w{2} \\w{3}";

 

   return isDate=str.matches(datePattern);

  }

0695b00000rPB8oAAG.png 

Regards

Shong