Jump to content
Sign in to follow this  
faustf

array and StringRegExp

Recommended Posts

hi guys , i have  a little problem 

when i pass array at  StringRegExp , not  work and  answerme  with  blank array ,  why ??

 

; == Option 1, using offset parameter

#include <MsgBoxConstants.au3>
#include <StringConstants.au3>
#include <Array.au3>
Local $Array[1]=['<ValueRecommendation><Value>- Senza marca/Generico']
_ArrayDisplay($Array)
Local $aArray = 0, _
        $iOffset = 1
While 1
    $aArray = StringRegExp($Array[0], '(?i)<ValueRecommendation><Value>(.*?)', $STR_REGEXPARRAYMATCH, $iOffset)
    If @error Then ExitLoop
    $iOffset = @extended
    For $i = 0 To UBound($aArray) - 1
        MsgBox($MB_SYSTEMMODAL, "RegExp Test with Option 1 - " & $i, $aArray[$i])
    Next
WEnd

thankz at  all  :)

 

Share this post


Link to post
Share on other sites

What text are you trying to get?

<ValueRecommendation><Value>

or

Senza marca/Generico

?


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Share this post


Link to post
Share on other sites
1 minute ago, kylomas said:

Faust,

Because you are setting the array to 0 after you set element 1.

Kylomas

 

No, he's declaring $aArray, not setting $array to 0


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Share this post


Link to post
Share on other sites

For Just

<ValueRecommendation><Value>

Change $STR_REGEXPARRAYMATCH to $STR_REGEXPARRAYFULLMATCH


For Just

Senza marca/Generico

Do $aArray = StringRegExpReplace($Array[0], '\<ValueRecommendation\>\<Value\>\-\s', "") instead of $aArray = StringRegExp($Array[0], '(?i)<ValueRecommendation><Value>(.*?)', $STR_REGEXPARRAYMATCH, $iOffset)


For both

Use StringSplit


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Share this post


Link to post
Share on other sites
; == Option 1, using offset parameter

#include <MsgBoxConstants.au3>
#include <StringConstants.au3>
#include <Array.au3>
Local $Array[1]=['<ValueRecommendation><Value>- Senza marca/Generico']
_ArrayDisplay($Array)
Local $aArray [0], _        ; *changed*
        $iOffset = 1
While 1
    $aArray = StringRegExp($Array[0], '(?i)<ValueRecommendation><Value>(.*?)', $STR_REGEXPARRAYFULLMATCH, $iOffset)  ; *changed*
    If @error Then ExitLoop
    $iOffset = @extended
    For $i = 0 To UBound($aArray) - 1
        MsgBox($MB_SYSTEMMODAL, "RegExp Test with Option 1 - " & $i, $aArray[$i])
    Next
WEnd

This code runs but probably isn't exactly where you after at? You want to do something with: "For $i = 0 To $aArray" but i don't understand exactly what you are trying to accomplish there.

Share this post


Link to post
Share on other sites

sorry  for  reteard  :)

not  work the solution

Do $aArray = StringRegExpReplace($Array[0], '\<ValueRecommendation\>\<Value\>\-\s', "") instead of $aArray = StringRegExp($Array[0], '(?i)<ValueRecommendation><Value>(.*?)', $STR_REGEXPARRAYMATCH, $iOffset)

i  want  extract  Senza marca/Generico 

:)

Edited by faustf

Share this post


Link to post
Share on other sites

You can do this.

 

#include <MsgBoxConstants.au3>
#include <StringConstants.au3>
#include <Array.au3>
Local $Array[1] = ['<ValueRecommendation><Value>- Senza marca/Generico']
$aArray = StringRegExp($Array[0], '(?i)<ValueRecommendation><Value>(.*?)$', $STR_REGEXPARRAYGLOBALMATCH)
_ArrayDisplay($aArray)

Saludos

Share this post


Link to post
Share on other sites

@mikell that's what I thought mainly . Regexp is very nice but when it really needed. I usually use it when I need to parse long strings.

In normal cases I would do this:

 

Local $Array[1] = ['<ValueRecommendation><Value>- Senza marca/Generico']
MsgBox(0, "", StringMid($Array[0], StringLen("<ValueRecommendation><Value>- ")))

Saludos

 

Share this post


Link to post
Share on other sites

so thank at  all , but   i have  anoter problem , explain  much better

i have  an  array  with this 

Row|Col 0
[0]|GetCategorySpecificsResponse xmlns="urn:ebay:apis:eBLBaseComponents"
[1]|<Timestamp>2016-09-17T14:19:58.767Z
[2]|Ack
[3]|Success
[4]|Version
[5]|971
[6]|Build
[7]|E971_INTL_API6_18007282_R1
[8]|Recommendations
[9]|<CategoryID>63867
[10]|NameRecommendation
[11]|<Name>Marca
[12]|ValidationRules
[13]|<ValueType>Text
[14]|MinValues
[15]|1
[16]|MaxValues
[17]|1
[18]|SelectionMode
[19]|FreeText
[20]|VariationSpecifics
[21]|Disabled
[22]|/ValidationRules
[23]|<ValueRecommendation><Value>- Senza marca/Generico -
[24]|ValidationRules/
[25]|
[26]|ValueRecommendation
[27]|<Value>7 For All Mankind
[28]|ValidationRules/
[29]|
[30]|ValueRecommendation
[31]|<Value>Abercrombie &amp; Fitch
[32]|ValidationRules/
[33]|
[34]|ValueRecommendation
[35]|<Value>adidas
[36]|ValidationRules/
[37]|
[38]|ValueRecommendation
[39]|<Value>All Saints
[40]|ValidationRules/
[41]|
[42]|ValueRecommendation
[43]|<Value>Almost Famous
[44]|ValidationRules/
[45]|
[46]|ValueRecommendation
[47]|<Value>American Vintage
[48]|ValidationRules/
[49]|
[50]|ValueRecommendation
[51]|<Value>Andrew Marc
[52]|ValidationRules/
[53]|
[54]|ValueRecommendation
[55]|<Value>Animal
[56]|ValidationRules/
[57]|
[58]|ValueRecommendation
[59]|<Value>Anita
[60]|ValidationRules/
[61]|
[62]|ValueRecommendation
[63]|<Value>Anne Weyburn
[64]|ValidationRules/
[65]|
[66]|ValueRecommendation
[67]|<Value>Anoushka G
[68]|ValidationRules/
[69]|
[70]|ValueRecommendation
[71]|<Value>Apple Bottoms
[72]|ValidationRules/
[73]|
[74]|ValueRecommendation
[75]|<Value>Aquascutum
[76]|ValidationRules/
[77]|
[78]|ValueRecommendation
[79]|<Value>Arena
[80]|ValidationRules/
[81]|
[82]|ValueRecommendation
[83]|<Value>Aristoc
[84]|ValidationRules/
[85]|
[86]|ValueRecommendation
[87]|<Value>ARMANI
[88]|ValidationRules/
[89]|
[90]|ValueRecommendation
[91]|<Value>Arturo Veneziani
[92]|ValidationRules/
[93]|
[94]|ValueRecommendation
[95]|<Value>ASOS
[96]|ValidationRules/
[97]|
[98]|ValueRecommendation
[99]|<Value>Atmosphere
[100]|ValidationRules/
[101]|
[102]|ValueRecommendation
[103]|<Value>Atticus
[104]|ValidationRules/
[105]|
[106]|ValueRecommendation
[107]|<Value>aussieBum
[108]|ValidationRules/
[109]|
[110]|ValueRecommendation
[111]|<Value>Austin Reed
[112]|ValidationRules/
[113]|
[114]|ValueRecommendation
[115]|<Value>Avirex
[116]|ValidationRules/
[117]|
[118]|ValueRecommendation
[119]|<Value>Awear
[120]|ValidationRules/
[121]|
[122]|/NameRecommendation
[123]|<NameRecommendation><Name>Taglia
[124]|ValidationRules
[125]|<ValueType>Text
[126]|MaxValues
[127]|1
[128]|SelectionMode
[129]|FreeText
[130]|/ValidationRules
[131]|<ValueRecommendation><Value>32
[132]|ValidationRules/
[133]|
[134]|ValueRecommendation
[135]|<Value>34
[136]|ValidationRules/
[137]|
[138]|ValueRecommendation
[139]|<Value>36
[140]|ValidationRules/
[141]|
[142]|ValueRecommendation
[143]|<Value>38
[144]|ValidationRules/
[145]|
[146]|ValueRecommendation
[147]|<Value>40
[148]|ValidationRules/
[149]|
[150]|ValueRecommendation
[151]|<Value>42
[152]|ValidationRules/
[153]|
[154]|ValueRecommendation
[155]|<Value>44
[156]|ValidationRules/
[157]|
[158]|ValueRecommendation
[159]|<Value>46
[160]|ValidationRules/
[161]|
[162]|ValueRecommendation
[163]|<Value>48
[164]|ValidationRules/
[165]|
[166]|ValueRecommendation
[167]|<Value>50
[168]|ValidationRules/
[169]|
[170]|ValueRecommendation
[171]|<Value>52
[172]|ValidationRules/
[173]|
[174]|ValueRecommendation
[175]|<Value>54
[176]|ValidationRules/
[177]|
[178]|ValueRecommendation
[179]|<Value>56
[180]|ValidationRules/
[181]|
[182]|ValueRecommendation
[183]|<Value>58
[184]|ValidationRules/
[185]|
[186]|ValueRecommendation
[187]|<Value>60
[188]|ValidationRules/
[189]|
[190]|ValueRecommendation
[191]|<Value>62
[192]|ValidationRules/
[193]|
[194]|ValueRecommendation
[195]|<Value>64
[196]|ValidationRules/
[197]|
[198]|ValueRecommendation
[199]|<Value>66
[200]|ValidationRules/
[201]|
[202]|ValueRecommendation
[203]|<Value>68
[204]|ValidationRules/
[205]|
[206]|ValueRecommendation
[207]|<Value>XS
[208]|ValidationRules/
[209]|
[210]|ValueRecommendation
[211]|<Value>S
[212]|ValidationRules/
[213]|
[214]|ValueRecommendation
[215]|<Value>M
[216]|ValidationRules/
[217]|
[218]|ValueRecommendation
[219]|<Value>L
[220]|ValidationRules/
[221]|
[222]|ValueRecommendation
[223]|<Value>XL
[224]|ValidationRules/
[225]|
[226]|ValueRecommendation
[227]|<Value>XXL
[228]|ValidationRules/
[229]|
[230]|/NameRecommendation
[231]|<NameRecommendation><Name>Misura
[232]|ValidationRules
[233]|<ValueType>Text
[234]|MaxValues
[235]|1
[236]|SelectionMode
[237]|FreeText
[238]|/ValidationRules
[239]|<ValueRecommendation><Value>II
[240]|ValidationRules/
[241]|
[242]|ValueRecommendation
[243]|<Value>III
[244]|ValidationRules/
[245]|
[246]|ValueRecommendation
[247]|<Value>IV
[248]|ValidationRules/
[249]|
[250]|ValueRecommendation
[251]|<Value>V
[252]|ValidationRules/
[253]|
[254]|ValueRecommendation
[255]|<Value>VI
[256]|ValidationRules/
[257]|
[258]|ValueRecommendation
[259]|<Value>VII
[260]|ValidationRules/
[261]|
[262]|/NameRecommendation
[263]|<NameRecommendation><Name>Stile
[264]|ValidationRules
[265]|<ValueType>Text
[266]|MaxValues
[267]|1
[268]|SelectionMode
[269]|FreeText
[270]|VariationSpecifics
[271]|Disabled
[272]|/ValidationRules
[273]|<ValueRecommendation><Value>Bikini completi
[274]|ValidationRules/
[275]|
[276]|ValueRecommendation
[277]|<Value>Costumi da nuoto
[278]|ValidationRules/
[279]|
[280]|ValueRecommendation
[281]|<Value>Monokini
[282]|ValidationRules/
[283]|
[284]|ValueRecommendation
[285]|<Value>Pantaloncini da tavola
[286]|ValidationRules/
[287]|
[288]|ValueRecommendation
[289]|<Value>Parti alte bikini
[290]|ValidationRules/
[291]|
[292]|ValueRecommendation
[293]|<Value>Parti alte tankini
[294]|ValidationRules/
[295]|
[296]|ValueRecommendation
[297]|<Value>Parti basse bikini
[298]|ValidationRules/
[299]|
[300]|ValueRecommendation
[301]|<Value>Sarongs, parei
[302]|ValidationRules/
[303]|
[304]|ValueRecommendation
[305]|<Value>Set tankini
[306]|ValidationRules/
[307]|
[308]|/NameRecommendation
[309]|<NameRecommendation><Name>Taglia torace
[310]|ValidationRules
[311]|<ValueType>Text
[312]|MaxValues
[313]|1
[314]|SelectionMode
[315]|FreeText
[316]|/ValidationRules
[317]|<ValueRecommendation><Value>28
[318]|ValidationRules/
[319]|
[320]|ValueRecommendation
[321]|<Value>30
[322]|ValidationRules/
[323]|
[324]|ValueRecommendation
[325]|<Value>32
[326]|ValidationRules/
[327]|
[328]|ValueRecommendation
[329]|<Value>34
[330]|ValidationRules/
[331]|
[332]|ValueRecommendation
[333]|<Value>36
[334]|ValidationRules/
[335]|
[336]|ValueRecommendation
[337]|<Value>38
[338]|ValidationRules/
[339]|
[340]|ValueRecommendation
[341]|<Value>40
[342]|ValidationRules/
[343]|
[344]|ValueRecommendation
[345]|<Value>42
[346]|ValidationRules/
[347]|
[348]|ValueRecommendation
[349]|<Value>44
[350]|ValidationRules/
[351]|
[352]|ValueRecommendation
[353]|<Value>46
[354]|ValidationRules/
[355]|
[356]|ValueRecommendation
[357]|<Value>48
[358]|ValidationRules/
[359]|
[360]|ValueRecommendation
[361]|<Value>50
[362]|ValidationRules/
[363]|
[364]|ValueRecommendation
[365]|<Value>52
[366]|ValidationRules/
[367]|
[368]|ValueRecommendation
[369]|<Value>54
[370]|ValidationRules/
[371]|
[372]|ValueRecommendation
[373]|<Value>2XS
[374]|ValidationRules/
[375]|
[376]|ValueRecommendation
[377]|<Value>XS
[378]|ValidationRules/
[379]|
[380]|ValueRecommendation
[381]|<Value>S
[382]|ValidationRules/
[383]|
[384]|ValueRecommendation
[385]|<Value>M
[386]|ValidationRules/
[387]|
[388]|ValueRecommendation
[389]|<Value>L
[390]|ValidationRules/
[391]|
[392]|ValueRecommendation
[393]|<Value>XL
[394]|ValidationRules/
[395]|
[396]|ValueRecommendation
[397]|<Value>XXL
[398]|ValidationRules/
[399]|
[400]|ValueRecommendation
[401]|<Value>Taglia unica
[402]|ValidationRules/
[403]|
[404]|/NameRecommendation
[405]|<NameRecommendation><Name>Taglia coppa
[406]|ValidationRules
[407]|<ValueType>Text
[408]|MaxValues
[409]|1
[410]|SelectionMode
[411]|FreeText
[412]|/ValidationRules
[413]|<ValueRecommendation><Value>A
[414]|ValidationRules/
[415]|
[416]|ValueRecommendation
[417]|<Value>AA
[418]|ValidationRules/
[419]|
[420]|ValueRecommendation
[421]|<Value>B
[422]|ValidationRules/
[423]|
[424]|ValueRecommendation
[425]|<Value>C
[426]|ValidationRules/
[427]|
[428]|ValueRecommendation
[429]|<Value>D
[430]|ValidationRules/
[431]|
[432]|ValueRecommendation
[433]|<Value>DD
[434]|ValidationRules/
[435]|
[436]|ValueRecommendation
[437]|<Value>E
[438]|ValidationRules/
[439]|
[440]|ValueRecommendation
[441]|<Value>F
[442]|ValidationRules/
[443]|
[444]|ValueRecommendation
[445]|<Value>FF
[446]|ValidationRules/
[447]|
[448]|ValueRecommendation
[449]|<Value>G
[450]|ValidationRules/
[451]|
[452]|ValueRecommendation
[453]|<Value>GG
[454]|ValidationRules/
[455]|
[456]|ValueRecommendation
[457]|<Value>H
[458]|ValidationRules/
[459]|
[460]|ValueRecommendation
[461]|<Value>HH
[462]|ValidationRules/
[463]|
[464]|ValueRecommendation
[465]|<Value>J
[466]|ValidationRules/
[467]|
[468]|ValueRecommendation
[469]|<Value>JJ
[470]|ValidationRules/
[471]|
[472]|ValueRecommendation
[473]|<Value>K
[474]|ValidationRules/
[475]|
[476]|ValueRecommendation
[477]|<Value>Taglia unica
[478]|ValidationRules/
[479]|
[480]|/NameRecommendation
[481]|<NameRecommendation><Name>Materiale
[482]|ValidationRules
[483]|<ValueType>Text
[484]|MaxValues
[485]|1
[486]|SelectionMode
[487]|FreeText
[488]|/ValidationRules
[489]|<ValueRecommendation><Value>Elastane, Spandex
[490]|ValidationRules/
[491]|
[492]|ValueRecommendation
[493]|<Value>Lycra
[494]|ValidationRules/
[495]|
[496]|ValueRecommendation
[497]|<Value>Poliammide
[498]|ValidationRules/
[499]|
[500]|ValueRecommendation
[501]|<Value>Poliestere
[502]|ValidationRules/
[503]|
[504]|ValueRecommendation
[505]|<Value>Sintetico
[506]|ValidationRules/
[507]|
[508]|/NameRecommendation
[509]|<NameRecommendation><Name>Scollatura
[510]|ValidationRules
[511]|<ValueType>Text
[512]|MaxValues
[513]|1
[514]|SelectionMode
[515]|FreeText
[516]|VariationSpecifics
[517]|Disabled
[518]|/ValidationRules
[519]|<ValueRecommendation><Value>Collo all&apos;americana
[520]|ValidationRules/
[521]|
[522]|ValueRecommendation
[523]|<Value>Con spalline
[524]|ValidationRules/
[525]|
[526]|ValueRecommendation
[527]|<Value>Sport
[528]|ValidationRules/
[529]|
[530]|ValueRecommendation
[531]|<Value>Scollo a V
[532]|ValidationRules/
[533]|
[534]|ValueRecommendation
[535]|<Value>Bandeau
[536]|ValidationRules/
[537]|
[538]|ValueRecommendation
[539]|<Value>Girocollo
[540]|ValidationRules/
[541]|
[542]|ValueRecommendation
[543]|<Value>Scollatura quadrata
[544]|ValidationRules/
[545]|
[546]|/NameRecommendation
[547]|<NameRecommendation><Name>Tipo di boxer
[548]|ValidationRules
[549]|<ValueType>Text
[550]|MaxValues
[551]|1
[552]|SelectionMode
[553]|FreeText
[554]|VariationSpecifics
[555]|Disabled
[556]|/ValidationRules
[557]|<ValueRecommendation><Value>Boxer
[558]|ValidationRules/
[559]|
[560]|ValueRecommendation
[561]|<Value>Culotte
[562]|ValidationRules/
[563]|
[564]|ValueRecommendation
[565]|<Value>Nodo sul fianco
[566]|ValidationRules/
[567]|
[568]|ValueRecommendation
[569]|<Value>Perizoma
[570]|ValidationRules/
[571]|
[572]|ValueRecommendation
[573]|<Value>Shorty
[574]|ValidationRules/
[575]|
[576]|/NameRecommendation
[577]|<NameRecommendation><Name>Fantasia
[578]|ValidationRules
[579]|<ValueType>Text
[580]|MaxValues
[581]|1
[582]|SelectionMode
[583]|FreeText
[584]|VariationSpecifics
[585]|Disabled
[586]|/ValidationRules
[587]|<ValueRecommendation><Value>A righe
[588]|ValidationRules/
[589]|
[590]|ValueRecommendation
[591]|<Value>Floreale
[592]|ValidationRules/
[593]|
[594]|ValueRecommendation
[595]|<Value>Nessuna fantasia
[596]|ValidationRules/
[597]|
[598]|ValueRecommendation
[599]|<Value>Pois
[600]|ValidationRules/
[601]|
[602]|ValueRecommendation
[603]|<Value>Stampa animalier
[604]|ValidationRules/
[605]|
[606]|/NameRecommendation
[607]|<NameRecommendation><Name>Tipo di taglia
[608]|ValidationRules
[609]|<ValueType>Text
[610]|MaxValues
[611]|1
[612]|SelectionMode
[613]|FreeText
[614]|/ValidationRules
[615]|<ValueRecommendation><Value>Piccola
[616]|ValidationRules/
[617]|
[618]|ValueRecommendation
[619]|<Value>Taglia comoda
[620]|ValidationRules/
[621]|
[622]|ValueRecommendation
[623]|<Value>Alto
[624]|ValidationRules/
[625]|
[626]|/NameRecommendation
[627]|<NameRecommendation><Name>Colore principale
[628]|ValidationRules
[629]|<ValueType>Text
[630]|MaxValues
[631]|1
[632]|SelectionMode
[633]|FreeText
[634]|/ValidationRules
[635]|<ValueRecommendation><Value>Arancione
[636]|ValidationRules/
[637]|
[638]|ValueRecommendation
[639]|<Value>Argento
[640]|ValidationRules/
[641]|
[642]|ValueRecommendation
[643]|<Value>Avorio
[644]|ValidationRules/
[645]|
[646]|ValueRecommendation
[647]|<Value>Beige
[648]|ValidationRules/
[649]|
[650]|ValueRecommendation
[651]|<Value>Bianco
[652]|ValidationRules/
[653]|
[654]|ValueRecommendation
[655]|<Value>Blu
[656]|ValidationRules/
[657]|
[658]|ValueRecommendation
[659]|<Value>Giallo
[660]|ValidationRules/
[661]|
[662]|ValueRecommendation
[663]|<Value>Grigio
[664]|ValidationRules/
[665]|
[666]|ValueRecommendation
[667]|<Value>Marrone
[668]|ValidationRules/
[669]|
[670]|ValueRecommendation
[671]|<Value>Multicolore
[672]|ValidationRules/
[673]|
[674]|ValueRecommendation
[675]|<Value>Nero
[676]|ValidationRules/
[677]|
[678]|ValueRecommendation
[679]|<Value>Oro
[680]|ValidationRules/
[681]|
[682]|ValueRecommendation
[683]|<Value>Rosa
[684]|ValidationRules/
[685]|
[686]|ValueRecommendation
[687]|<Value>Rosso
[688]|ValidationRules/
[689]|
[690]|ValueRecommendation
[691]|<Value>Verde
[692]|ValidationRules/
[693]|
[694]|ValueRecommendation
[695]|<Value>Viola
[696]|ValidationRules/
[697]|
[698]|/NameRecommendation
[699]|<NameRecommendation><Name>Colore esatto
[700]|ValidationRules
[701]|<ValueType>Text
[702]|MaxValues
[703]|1
[704]|SelectionMode
[705]|FreeText
[706]|/ValidationRules
[707]|<ValueRecommendation><Value>Albicocca
[708]|ValidationRules/
[709]|
[710]|ValueRecommendation
[711]|<Value>Antracite
[712]|ValidationRules/
[713]|
[714]|ValueRecommendation
[715]|<Value>Azzurro
[716]|ValidationRules/
[717]|
[718]|ValueRecommendation
[719]|<Value>Blu grigio
[720]|ValidationRules/
[721]|
[722]|ValueRecommendation
[723]|<Value>Blu nuvola
[724]|ValidationRules/
[725]|
[726]|ValueRecommendation
[727]|<Value>Blu oltremare
[728]|ValidationRules/
[729]|
[730]|ValueRecommendation
[731]|<Value>Blu scuro
[732]|ValidationRules/
[733]|
[734]|ValueRecommendation
[735]|<Value>Bronzo
[736]|ValidationRules/
[737]|
[738]|ValueRecommendation
[739]|<Value>Cachi
[740]|ValidationRules/
[741]|
[742]|ValueRecommendation
[743]|<Value>Cammello
[744]|ValidationRules/
[745]|
[746]|ValueRecommendation
[747]|<Value>Caramello
[748]|ValidationRules/
[749]|
[750]|ValueRecommendation
[751]|<Value>Carboncino
[752]|ValidationRules/
[753]|
[754]|ValueRecommendation
[755]|<Value>Caviale
[756]|ValidationRules/
[757]|
[758]|ValueRecommendation
[759]|<Value>Celeste
[760]|ValidationRules/
[761]|
[762]|ValueRecommendation
[763]|<Value>Champagne
[764]|ValidationRules/
[765]|
[766]|ValueRecommendation
[767]|<Value>Chiaro
[768]|ValidationRules/
[769]|
[770]|ValueRecommendation
[771]|<Value>Cioccolato
[772]|ValidationRules/
[773]|
[774]|ValueRecommendation
[775]|<Value>Cobalto
[776]|ValidationRules/
[777]|
[778]|ValueRecommendation
[779]|<Value>Corallo
[780]|ValidationRules/
[781]|
[782]|ValueRecommendation
[783]|<Value>Crema
[784]|ValidationRules/
[785]|
[786]|ValueRecommendation
[787]|<Value>Ecru
[788]|ValidationRules/
[789]|
[790]|ValueRecommendation
[791]|<Value>Fucsia
[792]|ValidationRules/
[793]|
[794]|ValueRecommendation
[795]|<Value>Fumo
[796]|ValidationRules/
[797]|
[798]|ValueRecommendation
[799]|<Value>Giallo banana
[800]|ValidationRules/
[801]|
[802]|ValueRecommendation
[803]|<Value>Giallo mais
[804]|ValidationRules/
[805]|
[806]|/NameRecommendation
[807]|<NameRecommendation><Name>Paese di origine
[808]|ValidationRules
[809]|<ValueType>Text
[810]|MaxValues
[811]|1
[812]|SelectionMode
[813]|FreeText
[814]|VariationSpecifics
[815]|Disabled
[816]|/ValidationRules
[817]|<ValueRecommendation><Value>Afghanistan
[818]|ValidationRules/
[819]|
[820]|ValueRecommendation
[821]|<Value>Albania
[822]|ValidationRules/
[823]|
[824]|ValueRecommendation
[825]|<Value>Algeria
[826]|ValidationRules/
[827]|
[828]|ValueRecommendation
[829]|<Value>Andorra
[830]|ValidationRules/
[831]|
[832]|ValueRecommendation
[833]|<Value>Angola
[834]|ValidationRules/
[835]|
[836]|ValueRecommendation
[837]|<Value>Anguilla
[838]|ValidationRules/
[839]|
[840]|ValueRecommendation
[841]|<Value>Antigua e Barbuda
[842]|ValidationRules/
[843]|
[844]|ValueRecommendation
[845]|<Value>Antille olandesi
[846]|ValidationRules/
[847]|
[848]|ValueRecommendation
[849]|<Value>Arabia Saudita
[850]|ValidationRules/
[851]|
[852]|ValueRecommendation
[853]|<Value>Argentina
[854]|ValidationRules/
[855]|
[856]|ValueRecommendation
[857]|<Value>Armenia
[858]|ValidationRules/
[859]|
[860]|ValueRecommendation
[861]|<Value>Aruba
[862]|ValidationRules/
[863]|
[864]|ValueRecommendation
[865]|<Value>Australia
[866]|ValidationRules/
[867]|
[868]|ValueRecommendation
[869]|<Value>Austria
[870]|ValidationRules/
[871]|
[872]|ValueRecommendation
[873]|<Value>Azerbaijan
[874]|ValidationRules/
[875]|
[876]|ValueRecommendation
[877]|<Value>Bahamas
[878]|ValidationRules/
[879]|
[880]|ValueRecommendation
[881]|<Value>Bahrain
[882]|ValidationRules/
[883]|
[884]|ValueRecommendation
[885]|<Value>Baliato di Jersey
[886]|ValidationRules/
[887]|
[888]|ValueRecommendation
[889]|<Value>Bangladesh
[890]|ValidationRules/
[891]|
[892]|ValueRecommendation
[893]|<Value>Barbados
[894]|ValidationRules/
[895]|
[896]|ValueRecommendation
[897]|<Value>Belgio
[898]|ValidationRules/
[899]|
[900]|ValueRecommendation
[901]|<Value>Belize
[902]|ValidationRules/
[903]|
[904]|ValueRecommendation
[905]|<Value>Benin
[906]|ValidationRules/
[907]|
[908]|ValueRecommendation
[909]|<Value>Bermuda
[910]|ValidationRules/
[911]|
[912]|ValueRecommendation
[913]|<Value>Bhutan
[914]|ValidationRules/
[915]|
[916]|/NameRecommendation
[917]|

in  this  array appear  the  father  of  category   is  signed  by  <name>

and  childe  by <value>

i  want  extract  the 1 father   and  after all child of first father , 2 father  child of  second father ......

for  do that  i create a script  like  this 

_ArrayDisplay($aResult) <---------------------------- here have a array with all category  father  and  all child 
    For $i = 0 To UBound($aResult) - 1
        Local $iPosition = StringInStr($aResult[$i], "<Name>")
        If $iPosition = 1 Then
            Local $aTipo =  StringRegExp($aResult[$i], '(?i)<Name>(.*?)$', $STR_REGEXPARRAYGLOBALMATCH)
            _ArrayDisplay($aTipo,'1')
        Else
            Local $aTipo1 =  StringRegExp($aResult[$i], '(?i)<Value>(.*?)$', $STR_REGEXPARRAYGLOBALMATCH)
            _ArrayDisplay($aTipo1,'2')
        EndIf

        ;MsgBox(0, '', $aResult[$i])
    Next

but  the  first  father [11]|<Name>Marca   ok   do  good  and  also  yours child  ,

but  the  second father  [123]|<NameRecommendation><Name>Taglia   ,  not   recover  ,   but  child of them yes  

i  tryed also with  insert  <NameRecommendation><Name>  (only fot test )  but nothing

some one can help me??? :)

thankz  alot  at  all

 

Share this post


Link to post
Share on other sites

Suggestion...

#Include <Array.au3>

;$array = StringRegExp(FileRead("array.txt"), '\|(\N*)', 3)
; _ArrayDisplay($array)

; <<< use your array as $array >>>

$u = UBound($array)
Local $res[$u][2], $n

For $i = 0 to $u - 1
    If StringInStr($array[$i], "<Name>") Then 
         $res[$n][0] = StringRegExpReplace($array[$i], '.*<Name>(.*)', "$1")
         $n += 1
    ElseIf StringInStr($array[$i], "<Value>") Then 
         $res[$n][1] = StringRegExpReplace($array[$i], '.*<Value>(.*)', "$1")
         $n += 1
   EndIf
Next
Redim $res[$n][2]
  _ArrayDisplay($res)

 

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...