Jump to content
Sign in to follow this  
Hypnotik

Transporting letters to another file with filter

Recommended Posts

Hypnotik

Hey :)

i'd like to read a txt file containing letters, and i want to move them into another txt file, but to move only the words that dont contain a "-" and that are smaller than 6 letters

is that possible?

Share this post


Link to post
Share on other sites
Danyfirex

Yes is Posible.

Example of the file?

Share this post


Link to post
Share on other sites
Danyfirex

I don't see any "-"  I think you Mean "_"

Share this post


Link to post
Share on other sites
Hypnotik

I don't see any "-"  I think you Mean "_"

Yep sorry i meant _

Share this post


Link to post
Share on other sites
Danyfirex

maybe not the most efficient way but it should work.

#include <Array.au3>
#include <File.au3>


Local $Data=FileRead("au.txt")

$Data=StringRegExpReplace($Data,"[A-Za-z_]{6,}",".")
$Data=StringRegExp($Data,"[A-Za-z]{1,5}",3)

_ArrayDisplay($Data)

_FileWriteFromArray("newau.txt",$Data)

Saludos

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.