Home > Blockchain >  Needing direction using REGEX in Notepad to find length of characters in line that also contains s
Needing direction using REGEX in Notepad to find length of characters in line that also contains s

Time:11-13

I have a TEXT file where I have 4700 lines of a 30 character value. The numerical characters are in position 1 through 8 and then there are only spaces supposedly after. I am using REGEX in NOTEPAD to find 2 separate scenarios:

  1. I would like to find if there exists on any line of my text file the length of characters in position 1-8 that are less than 6.
  2. Are there any lines in my text file that have a length > 30. I think I found the answer to this but would like some confirmation as I am not picking up anything in my results. Here is my what I'm using in NOTEPAD find these values: .{30, }

Any help/direction would be appreciated. Thanks.

Here is a sample of what my file looks like:

332268-1                      
322335                        
322375                        
322393                        
322368-1                      
322381                        
322475                        
323912-1                      
322539                        
322641                        
322641                        
322514-1                      
322638                        
322978                        
322978                        
322638-1                      
287686                        
287735                        
322579                        
322643                        
323113                        
323257                        
331875                        
331875                        
322637-1                      
322720-1                      
322745-1                      
322679                        
322702                        
322971                        
324548                        
322971                        
333146-1                      

CodePudding user response:

Number 1 would be ^\d{0,5}\s \n

 ^ matches the beginning of the string or line
 \d digit
 {0,5} matches quantify or proceeding token
 \s whitespace
   quantifier matches 1 or more
 \n is a new line

Number 2 would be ^.{31,}

 ^ matches the beginning of the string or line
 . matches any character but line breaks
 {31,} matches any line that is 31 characters or greater.
  • Related