Jump to content

Help : Choose many special texts in a paragraph ...


gerym
 Share

Recommended Posts

My work is : I have one file abc.txt , in this file there is many special names and I must collect them , then report all of them . Ex : in 1 paragraph as :

London sdjksdjkfhdskfhsjkfhdsjkf Paris kldfjkldsjfdslkfjsldfkj New York sdjkfhdsjkfhdsjkfdshfksh London blah blah blah ...

I must delete all but "London" , "Paris" and "New York" ... and the last it is : London Paris New York London ... so I can save it .

Any ideas ? Thanks first if u can help me :)

Edited by gerym
Link to comment
Share on other sites

look at StringRegExp or StringReplace

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

Example

#include-once
#include <Array.au3>

$sString = "London sdjksdjkfhdskfhsjkfhdsjkf Paris kldfjkldsjfdslkfjsldfkj New York sdjkfhdsjkfhdsjkfdshfksh London blah blah blah ..."
RegEx ( $sString )
MsgBox( 64, 'Replaced', $sString )

Func RegEx( ByRef $sString )
$aRet = StringRegExp ( $sString, '(London|Paris|New York)', 3 )
$sString = _ArrayToString( $aRet , ' ' )
EndFunc

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

No, you shouldn't ;)

Usually we don't hand feed users here. We try to teach them how to fish.

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

 

Link to comment
Share on other sites

I was just messing Water as i prefer to try and write my own scripts then if i get stuck then yes i would ask with some code to gt told "wooow there is a much better way lol" but as John said all posts have been without code an i believe one thread closed for game related.

Link to comment
Share on other sites

Thanks all . i understood what u said ...

and btw , PhoenixXL , i like your avatar ...

Sr for 1 more question : How can split $sString , ex $a1 = "London" , $a2 = "Paris" , $a3 = "New York" , $a4 = "London" ???

sorry for my bad :| I'm not good at english so something I understand and else i don't :(

Link to comment
Share on other sites

You don't need to split $sString. $aRet is alread the array you need.

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

 

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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