AGG Software Forums
December 03, 2024, 07:56:17 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome on our forum!
 
   Home   Help Search Login Register  

Pages: [1]
  Print  
Author Topic: leading zeros  (Read 21775 times)
dafrenchman
Jr. Member
**

Karma: +0/-0
Posts: 15


View Profile
« on: August 12, 2020, 07:44:59 PM »

Allo,

Is there a way to remove leading zeros in a parsed string item?
I think maybe via expressions plugin?

Example

0088-190031 should become 88-190031

Thanks,
                                                                                                                                                                                                                                                                                                                                                                       
Logged
Arthur Grasin
Tech. Support
Administrator
Hero Member
*****

Karma: +0/-0
Posts: 806



View Profile WWW
« Reply #1 on: August 13, 2020, 07:20:03 AM »

Hello,

Could you please show me your full data packet. It is possible, you may use a regular expression to extract data as you want.

Otherwise, you should use the "Script execute" plugin.
Logged
dafrenchman
Jr. Member
**

Karma: +0/-0
Posts: 15


View Profile
« Reply #2 on: August 21, 2020, 03:46:27 PM »

Allo,

Below are 2 data packets. with desired results.

First sample

?880698-00-2061    28103@
need to parse as
field 1           880698-00-2      (11 characters)
field 2           061                   (3 characters)
field 3           28103                (up to 9 characters)


Second sample

?0088-190031061    28230@
need to parse as
field 1           88-190031         (9 characters with first leading 0 dropped)
field 2           061                    (3 Characters)
field 3           28230                (up to 9 characters)


I hope this can be done.

Thanks.
« Last Edit: August 21, 2020, 04:13:00 PM by dafrenchman » Logged
Arthur Grasin
Tech. Support
Administrator
Hero Member
*****

Karma: +0/-0
Posts: 806



View Profile WWW
« Reply #3 on: August 22, 2020, 09:16:33 AM »

Try the following:

Sart signature: ?
End signature: @
Parse full data packet: yes

The regular expression for the first variable:

\?0*([\d\-]+)\d{3}\ {3}

The regular expression for the second variable:

(\d{3})\ {3}

The regular expression for the 3rd variable:

(\d+)\@
Logged
dafrenchman
Jr. Member
**

Karma: +0/-0
Posts: 15


View Profile
« Reply #4 on: August 24, 2020, 06:03:41 PM »

Thank you.

Just to make sure I understand.
This would be used in the expressions plugin?

CB
Logged
Arthur Grasin
Tech. Support
Administrator
Hero Member
*****

Karma: +0/-0
Posts: 806



View Profile WWW
« Reply #5 on: August 25, 2020, 06:45:16 AM »

You should use it in the ASCII Data Parser plugin.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines