Sign in to follow this  
Followers 0
toonboon

RegExp issues

3 posts in this topic

#1 ·  Posted (edited)

Hello,

I am trying to import some mtg cards into a database for personal track-keeping.

Whilst testing the program I came to an issue when processing the card information.

<img src="/Handlers/Image.ashx?size=small&amp;name=tap&amp;type=symbol" alt="Tap" align="absbottom" />: Add <img src="/Handlers/Image.ashx?size=small&amp;name=3&amp;type=symbol" alt="3" align="absbottom" /> to your mana pool.

<img src="/Handlers/Image.ashx?size=small&amp;name=3&amp;type=symbol" alt="3" align="absbottom" />: Untap Basalt Monolith.

should become

Basalt Monolith doesn't untap during your untap step.

{T}: Add {3} to your mana pool.

{3}: Untap Basalt Monolith.

The code I have thus far for this is

$sText = StringReplace(StringReplace(StringReplace($sText, '<img src="/Handlers/Image.ashx?size=small&amp;name=', '') _, '&amp;type=symbol" ', '') _, ' align="absbottom" />', '')

Which makes it easier for processing with the help of a regular expression by trimming it down to this:

Basalt Monolith doesn't untap during your untap step.

tapalt="Tap": Add 3alt="3" to your mana pool.

3alt="3": Untap Basalt Monolith.

Now the part which I actually need help with, the regular expression. Right now I have the following:

$sText = StringRegExpReplace($sText, '([:alnum:]+)((alt=")(.*?{1})")', '{1}')

But this doesn't work. I have no idea why, it looks correct to me, but it just doesn't.

If anyone could help me with this by either just giving me a correct line of code to use or, much preferred, telling me what's wrong and explaining a solution to me. That'd be great.

Edited by toonboon

[right]~What can I say, I'm a Simplistic person[/right]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

toonboon,

Have you read the Forum Rules? Please read them now - particularly the bit about not discussing game interaction - and then you will understand why you will get no help and this thread will now be locked. :naughty:

See below. :)

M23

Edited by Melba23
Thread reopened

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thread reopened after explanation. The OP has convinced me that this relates solely to the physical card version of the game and not the online version. :)

; -----------------------------------------------

toonboon,

The source you posted does not contain everything you want to extract - please post a full version so we can develop a suitable algorithm. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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