Sign in to follow this  
Followers 0
darkshark

please, helpme in one loop statment

5 posts in this topic

#1 ·  Posted (edited)

i have this string:

[categoria = 'category 1' or categoria = 'category 2' or categoria = 'category 3' or categoria = 'category 4']

I need to capture the data that is between quots, and write them in a text file

the problem is that not always the same amount of words for me to use the StringMid ...

sometimes has 3 'categorys' sometimes only 1 and etc...

in the end I need to do the following:

FileWriteLine($log, $string & @CRLF)

where $log is my log file 'log.txt'

and $string are the word that is between quots

thanks

Edited by darkshark

Share this post


Link to post
Share on other sites



_stringbetween would probably work.


The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post


Link to post
Share on other sites

This looks like you need StringRegExp, probably something like this:

Local $string = "[categoria = 'category 1' or categoria = 'category 2' or categoria = 'category 3' or categoria = 'category 4']"
Local $CategoryArray = StringRegExp ($string, "'([^']+)'", 3)


#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Share this post


Link to post
Share on other sites

StringRegExp().

Why? Like Chris Cagle says: "Cause the chicks dig it!"

#include <Array.au3>

$sInput = "[categoria = 'category 1' or categoria = 'category 2' or categoria = 'category 3' or categoria = 'category 4']"
$aOutput = StringRegExp($sInput, "(?:categoria = ')([^']+)", 3)
If @error Then
    ConsoleWrite("Error:  @error = " & @error & "; @extended = " & @extended & @LF)
Else
    _ArrayDisplay($aOutput, "$aOutput")
EndIf

:(


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

StringRegExp().

Why? Like Chris Cagle says: "Cause the chicks dig it!"

#include <Array.au3>

$sInput = "[categoria = 'category 1' or categoria = 'category 2' or categoria = 'category 3' or categoria = 'category 4']"
$aOutput = StringRegExp($sInput, "(?:categoria = ')([^']+)", 3)
If @error Then
    ConsoleWrite("Error:  @error = " & @error & "; @extended = " & @extended & @LF)
Else
    _ArrayDisplay($aOutput, "$aOutput")
EndIf

:(

it's work

thankyou so much!

thanks for all

Edited by darkshark

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