Page 1 of 1

How to find words from .txt file using specific pattern

Posted: Thu Jul 22, 2010 10:47 am
by firian
It's my first post here, so hi all.
Anyway, I am trying to work this out, but can't do this alone. I have 30 lines of text, 5 lines for example:

??D
??R?
??T?
?P??
F???

The pattern itself always contains 30 lines that contains words made from 3, 4 or 5 letters. There is always only 1 letter assigned, the ? are wildcards and anything can be placed here. What do I need ? - example:

??D RED
??R? BIRD
??T? BITS

I am trying to assign a random word to every line using the pattern where ??D is any 3-letters word that ends with D etc. I already prepared wordlists, but can't add them as attachment ("The extension txt is not allowed.").

To be honest, I am not a good programmer and have no idea how to make it. Any help or advice will be appreciated.

Re: How to find words from .txt file using specific pattern

Posted: Thu Jul 22, 2010 1:36 pm
by Gargoyle
- split the text using explode("\n")
- cycle through the lines using foreach()
- filter each line as you wish
- append strings as you wish

Re: How to find words from .txt file using specific pattern

Posted: Fri Jul 23, 2010 12:18 pm
by katierosy
If you will search net and read on regular expressions, you may be able to do these tasks with the help of what is already mentioned in this forum.