Jump to content

Recommended Posts

Posted

Yes, I think that is what he wants.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

  • Replies 91
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

kylomas,

Yes and one other number.

$sNd1 = "01 02 14 32 37"

01 02 07 14 32 37

and 07 is other number and delete this line 01 02 07 14 32 37

That's all.

GRR, my Eng.

Posted (edited)

I updated the code from Please try again.

RegEx only split lines with @LF and last line has no @LF!

Btw, you must enter the exact line with the combination otherwise search for that particular element will fail.

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted

@water, et al,

Is it possible in regex to find all lines that contain a set ( in this case numbers)?

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Posted

@Read

Is it always the third block of numbers that is "unknown" like in "01 02 07 14 32 37" or is possible to be at any other position like in "01 02 14 17 32 37"?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

@water,

That is why I asked about regex. Finding a "set" with regex has to be better than testing each number on each line against all positions in a search argument (my processor is sore just thinking about it).

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Posted

Read,

We are shooting at a moving target. Will it always be 5 numbers and can the missing number be in any position?

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Posted

In your 1st post you have 7 lines of combinations.

Removing 2 lines means 5 lines left.

Btw, I updated the code again which should also work for multible double lines.

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted

If we search for "01 02 14 32 37" it should find "01 02 07 14 32 37" and "01 02 14 17 32 37" and delete this records. I'm just trying to find the correct regexp for that.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

@UEZ,

The 5 does NOT mean lines. It means number of numbers in the search argument.

@Read - Is this right?

I think I have a regex that will work but the search argument numbers have to appears in the same order as the line they might be found in.

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Posted

@water,

A regex that will work is ".*nn.*nn.*nn.*" where nn = each number to search for, but they have to be in the order that they might be found (example of 3 number search argument)

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Posted

Yes, exactly!!!!!

If we search for "01 02 14 32 37" it should find "01 02 07 14 32 37" and "01 02 14 17 32 37" and delete this records. I'm just trying to find the correct regexp for that.

Posted (edited)

if its only a max of 5 strings seems easier to handle them independently. Probably slower, but seems effective.

#Include <File.au3>
#Include <Array.au3>

Global $Farray

$sNd1 = "01"
$sNd2 = "02"
$sNd3 = "14"  
$sNd4 = "37"

$tNd1 = "01"
$tNd2 = "03"
$tNd3 = "06"
$tNd4 = "07"
$tNd5 = "43"

filecopy ("combo.txt" , "combobackup.txt")
_FileReadToArray ("combo.txt" , $Farray)

_ArrayDelete ($Farray , 0)


for $i = ubound ($Farray) -1 to 0 step -1
if stringinstr($Farray[$i], $sNd1) And stringinstr($Farray[$i] , $sNd2) And stringinstr($Farray[$i] , $sNd3) And stringinstr($Farray[$i] , $sNd4) Then
    _ArrayDelete ($Farray , $i)
elseif  stringinstr($Farray[$i], $tNd1) And stringinstr($Farray[$i] , $tNd2) And stringinstr($Farray[$i] , $tNd3) And stringinstr($Farray[$i] , $tNd4) And stringinstr($Farray[$i] , $tNd5)Then
    _ArrayDelete ($Farray , $i)
Endif
Next

_FileWriteFromArray ("combo.txt" , $Farray)
Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Posted (edited)

This works for the cases I described in my last post.

$iResult = StringRegExp($sString2, '(01).+(02).+(14).+(32).+(37)')

Edit: Too late :)

@kylomas

Your solution works for 5 groups of numbers as well.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

@boththose

This work but terrible to manage.

Array sounds good where I can paste our combinations - 100+.

Like PHP code:

$find= array(array(01, 02, 14, 37), array(01, 03, 06, 07, 43));

Big Thanks

Posted

Read,

You should store all delete entries in a file. Your application should read the file and construct regex replace stmts based on matches as water and I have been discussing.

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...