Sign in to follow this  
Followers 0
gerym

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

10 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

hmm ... I don't understand ... can u give me code for example ...

Share this post


Link to post
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

1 person likes this

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.

Share this post


Link to post
Share on other sites

Maybe i should just start asking for code rather than learning :/

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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.

Share this post


Link to post
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 :(

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0