regex

Regex number amount validation

佐手、 提交于 2021-02-11 07:40:27
问题 I want to validate the amount with the below scenario. The below regex is working except ',' for example 1,000.0000 ^(?!0*(\.0+)?$)(\d*(?:\.[0-9]{0,4})?)$ 1 - should pass 0.1 - should pass .1 - should pass 0 - should fail .0001 - should pass .10 - should pass 0.0 - should fail 0.00000 - should fail (only accept 4 digits after the decimal point) 1.0000 - should pass 1,000.0000 - should pass 1,000,00.000 - should pass 1,000.0000 - should pass 回答1: ^(?![0,]*(\.0+)?$)([,\d]*(?:\.[0-9]{0,4})?)$ .

Regex number amount validation

倾然丶 夕夏残阳落幕 提交于 2021-02-11 07:40:16
问题 I want to validate the amount with the below scenario. The below regex is working except ',' for example 1,000.0000 ^(?!0*(\.0+)?$)(\d*(?:\.[0-9]{0,4})?)$ 1 - should pass 0.1 - should pass .1 - should pass 0 - should fail .0001 - should pass .10 - should pass 0.0 - should fail 0.00000 - should fail (only accept 4 digits after the decimal point) 1.0000 - should pass 1,000.0000 - should pass 1,000,00.000 - should pass 1,000.0000 - should pass 回答1: ^(?![0,]*(\.0+)?$)([,\d]*(?:\.[0-9]{0,4})?)$ .

Regex number amount validation

自古美人都是妖i 提交于 2021-02-11 07:40:07
问题 I want to validate the amount with the below scenario. The below regex is working except ',' for example 1,000.0000 ^(?!0*(\.0+)?$)(\d*(?:\.[0-9]{0,4})?)$ 1 - should pass 0.1 - should pass .1 - should pass 0 - should fail .0001 - should pass .10 - should pass 0.0 - should fail 0.00000 - should fail (only accept 4 digits after the decimal point) 1.0000 - should pass 1,000.0000 - should pass 1,000,00.000 - should pass 1,000.0000 - should pass 回答1: ^(?![0,]*(\.0+)?$)([,\d]*(?:\.[0-9]{0,4})?)$ .

Can i use REGEXP_LIKE as a condition with IF in a PL/SQL block

谁说胖子不能爱 提交于 2021-02-11 07:22:30
问题 I'm trying to create a function designed to traverse a tree of organisational units filtering out some based on their level in the tree structure and weather they appear on our intranet page. The input to the function is the ORG_UNIT_ID of the starting unit, a flag to show if we should care about the intranet flag and a comma separated list of levels. For instance '2,3'. I'm trying to use REGEXP_LIKE in conjunction with an ELSEIF inside a loop to run up the tree until I hit the first eligible

Can i use REGEXP_LIKE as a condition with IF in a PL/SQL block

这一生的挚爱 提交于 2021-02-11 07:20:09
问题 I'm trying to create a function designed to traverse a tree of organisational units filtering out some based on their level in the tree structure and weather they appear on our intranet page. The input to the function is the ORG_UNIT_ID of the starting unit, a flag to show if we should care about the intranet flag and a comma separated list of levels. For instance '2,3'. I'm trying to use REGEXP_LIKE in conjunction with an ELSEIF inside a loop to run up the tree until I hit the first eligible

How to read a file and get certain lines in Linux

帅比萌擦擦* 提交于 2021-02-11 07:16:19
问题 I have a file and it has content like this: abc.com. IN A 10.10.40.94 ;10.120.40.61 ;10.60.3.135 def.com. IN CNAME some-domain.com. xyz.com. IN A 10.123.40.32 ;10.145.40.133 ;1.240.3.215 one.com. IN CNAME some-other-domain.com. What I want to do is, get all the lines with IN A and print them to another file so the final file would look like below: I tried awk as follows: cat dev-mytaxi.com.zone | awk '{print $3}' but how can I write to a file and the final outcome as mentioned below? final

How to read a file and get certain lines in Linux

送分小仙女□ 提交于 2021-02-11 07:15:56
问题 I have a file and it has content like this: abc.com. IN A 10.10.40.94 ;10.120.40.61 ;10.60.3.135 def.com. IN CNAME some-domain.com. xyz.com. IN A 10.123.40.32 ;10.145.40.133 ;1.240.3.215 one.com. IN CNAME some-other-domain.com. What I want to do is, get all the lines with IN A and print them to another file so the final file would look like below: I tried awk as follows: cat dev-mytaxi.com.zone | awk '{print $3}' but how can I write to a file and the final outcome as mentioned below? final

How to read a file and get certain lines in Linux

妖精的绣舞 提交于 2021-02-11 07:15:04
问题 I have a file and it has content like this: abc.com. IN A 10.10.40.94 ;10.120.40.61 ;10.60.3.135 def.com. IN CNAME some-domain.com. xyz.com. IN A 10.123.40.32 ;10.145.40.133 ;1.240.3.215 one.com. IN CNAME some-other-domain.com. What I want to do is, get all the lines with IN A and print them to another file so the final file would look like below: I tried awk as follows: cat dev-mytaxi.com.zone | awk '{print $3}' but how can I write to a file and the final outcome as mentioned below? final

How to read a file and get certain lines in Linux

佐手、 提交于 2021-02-11 07:14:12
问题 I have a file and it has content like this: abc.com. IN A 10.10.40.94 ;10.120.40.61 ;10.60.3.135 def.com. IN CNAME some-domain.com. xyz.com. IN A 10.123.40.32 ;10.145.40.133 ;1.240.3.215 one.com. IN CNAME some-other-domain.com. What I want to do is, get all the lines with IN A and print them to another file so the final file would look like below: I tried awk as follows: cat dev-mytaxi.com.zone | awk '{print $3}' but how can I write to a file and the final outcome as mentioned below? final

Python regex substitution using a dictionary to clean up domain names

一笑奈何 提交于 2021-02-11 07:06:36
问题 For the output, need to replace the brackets contain a digits with periods '.'. Also remove the brackets at the beginning and end of the domain. Can we use re.sub for this and if so how? code import re log = ["4/19/2020 11:59:09 PM 2604 PACKET 0000014DE1921330 UDP Rcv 192.168.1.28 f975 Q [0001 D NOERROR] A (7)pagead2(17)googlesyndication(3)com(0)", "4/19/2020 11:59:09 PM 0574 PACKET 0000014DE18C4720 UDP R cv 192.168.2.54 9c63 Q [0001 D NOERROR] A (2)pg(3)cdn(5)viber(3)com(0)"] rx_dict = {