annuler
Affichage des résultats de 
Rechercher plutôt 
Vouliez-vous dire : 

Regular Expression

Hi,

I am trying to parse an IP address from a string, i am using this  :
[0-9]*.[0-9]*.[0-9]*.[0-9]*
but the * doesn't limit to 3 numbers, how can i do this parse?

0 Compliments
Message 1 sur 10
4 505 Visites
Hi Alvarion,
which function do you use to parse your string? You can also have an IP adress, where all fields have only 2 numbers. Smiley clignant de l'œil

Mike
0 Compliments
Message 2 sur 10
4 500 Visites
hey,

I want to use the Match Pattern vi and i to parse any combination of the ip address, with 2,3 or even 1.
0 Compliments
Message 3 sur 10
4 498 Visites

[0-9][0-9][0-9]\.[0-9][0-9][0.9] and so on.  dont have labview up right now but this should match 3 digits folowed by a period and repete the pattern until you have the 4 triplets needed for an ip address.

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Compliments
Message 4 sur 10
4 490 Visites
sorry didnt put much thought in my last answer, this only matched 3 numbers.  You can use the optional escape clause for the 2nd and 3rd digit [0-9].
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Compliments
Message 5 sur 10
4 487 Visites
Thanks
0 Compliments
Message 6 sur 10
4 481 Visites
How about "String to IP" from the "communications..protocols...tcp" palette?
 
You should also be aware that each octet is U8 (0..255), so even if you limit to three digits, you could have problems, e.g. 300.400.500.600 is illegal.
0 Compliments
Message 7 sur 10
4 458 Visites
In addition to what Altenbach said, you might want to make a VI out of this with error I/O and validate the IP address in there. A very simple way of doing this is by using Scan From String with %d.%d.%d.%d as the format string and then checking the results using In Range & Coerce.

___________________
Try to take over the world!
Message 8 sur 10
4 447 Visites
Thanks to you all
0 Compliments
Message 9 sur 10
4 442 Visites

Off hand I couldnt remember but the optional escape claues in RE is ? to matching 2 or 3 numbers becomes [0-9][0-9][0-9]? and batching a period is\.  it is all comming back to me now.

 

paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Compliments
Message 10 sur 10
4 423 Visites