Babi Astimal Astimal

Greenhorn
+ Follow
since Aug 06, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Babi Astimal Astimal

this what you asked after formating the text :




thanks for the trick knute .
                                                               
1 year ago
the loop is only for :



2/ the data found after executing of the loop ( the first line repeated 3 times ) it dosen't take the next line matched with regx ( link attached).



3/ I have tried to make add  ( data.equals("INFOP-") and remove the loop   but i get only one line :

1 year ago
hi knute:

thanks a lot of for your reply:

it remains only one thing and i stuck on it .

this a link for my test:  https://regex101.com/r/OxoKwE/1.

the regx match all line of INFOP in the link listed above but when I run the code it parse only one line for example i have tried this :

[infop="INFOP-0-0"
namePlat="EQUIPW"
ti="0"
val1="10"
LEVELINFO=DATA=INFOP-0-0 &&NAMEPLAT=  EQUIPW&&TI=0&&VAL1=10



NB: i have tried to make  a loop to parse all line but no result what can I do now ?

thanks

1 year ago
hi carey:

sorry for my late reply i was sick.

yes as a beginner i have asked help nothing more and all your advice helped me you and Knute Snortum also and thanks for that.

i will use the first code and it work 70% .

NB : shall I ask help again?
1 year ago
like this but I still get error :



error:

1 year ago
ah ok I missed it .

Now error has gone but one I click on run button :

I have a result and  another  error is displayed even info group is declared




1 year ago
hi Knute Snortum  :

I have followed the correction done by the compiler .

Now I have corrected it but I still get the same error :



the Error:

Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.NullPointerException
at java.util.regex.Pattern.<init>(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at rexdemo4$Group.<init>(rexdemo4.java:41)
at rexdemo4.<clinit>(rexdemo4.java:28)
1 year ago
I have this message fault error:

Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.NullPointerException
at java.util.regex.Pattern.<init>(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at rexdemo4$Group.<init>(rexdemo4.java:41)
at rexdemo4.<clinit>(rexdemo4.java:28)



sorry I have to put the whole code thanks to correct me :

1 year ago
hi Knute Snortum:

yes I have already started using textarea from my first message :

textarea.append().



Now how to put or call bellow code inside  the code listed above ?

1 year ago
hi Knute Snortum  :

I have followed your advices from the begining

I have followed carey's advices also that was the answer listed bellow :


This is my approach to handling multiple regex's: I built a helper class called "Group" that is easily processed in a loop. And to reiterate: no GUI and no formatted output at this point.



I have posted more codes which show that i'm trying to do something.

carey code work fine but I can't find how to keep it and add textarea and button tha's why I asked help.



1 year ago
hi carey:

your code work fine I didn't pay attention all INFOP are gathered at once .

now just for design purpuse I want my result will be displayed inside JtextArea with  use of JRadioButton  in order to get bellow  information can you help us ?


LEVELINFO=DATA=INFO-0&&NAME=EQUIP&&VERAT2=v22&&CMD4= BYTE
LEVELINFO=DATA=INFOG-0&&MAC1=$1&&MAC2=IPARP  
LEVELINFO=DATA=INFOT-0  
LEVELINFO=DATA=INFOC-0&&ADRS=1&&4
LEVELINFO=DATA=IINFOP-0-0 &&NAMEPLAT=EQUIPW&&TI 0+&&VAL1=10&&VAL2=11&&13

thanks
1 year ago
hi Carey:

lines are  just  long for explanation purpuse  but it is noted .

1/ can you explain the use of breck in your code ?




2/  how to make a list of all found groups and then provide logic to pick the groups you want to print to a txt file?

thanks
1 year ago
hi Carey:

it works fine thanks a lot of .

I have two other questions :

1/   now I will add another regx but I want to make a loop to parse all   ( INFOP-) at once because the code display only  INFOP-0-0  and stop .

NB: INFOZ and INFOY  and INFOD their  related REGX will be added later and may be it is the same case with INFOP ( trough a loop)

I will add a new text file to explain that  ( https://www.cjoint.com/c/IHwmfnn17J5).

firstly bellow what I did:





2/  can we count the number of  EQUIPW by taken as condition only the last char ( W) .

for example in my DATA1 there is two EQUIPW  so I put the result in Jedittext or jlable ( found two )

if I change EQUIPW by EQUIPZ now the last char is changed to Z I will get ( one found EQUIPZ )

thanks


1 year ago
hi :

I have tried with this :

(?<infoc>INFOC-\\d{1,3})\\s+(?<adrs1>\\d{1,3}+).*" + NL  (  work fine ).

but secand and third not OK .



thanks
1 year ago
hi all:

the problem was in space now the first regx and second are workin fine .



2/ I'm working now on the third REGX but it is not working:



in order to have this :

LEVELINFO=DATA=INFOC-0&&ADRS=1&&4

Im' triying to get the first number which is 1 and the lasr number which is 4  from ADRS


1 year ago