Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Help with regex match and replace

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-02-2008, 10:20 AM
Basic4ppc Veteran
 
Join Date: Apr 2008
Location: Gosford NSW Australia
Posts: 223
Send a message via MSN to tsteward
Default Help with regex match and replace

Would anyone be able to knock up a quick routine so I can learn how to implement Regex controls.

I wish to search a string to find all occurrences of "*" some text and "*"
Then replace it with "<b>" the text "</b>"

Playing around with a regex builder I have come up with this code to find the matches:
\*([^\*]+)\*

And this regex to replace the text:
<b>$1<\\b>

So my question is how do I implement this into basic 4 ppc.

Thank you
Tony
__________________
PC: Dual core 3.4ghz 2gb ram
PPC: I-mate Jasjam
Reply With Quote
  #2 (permalink)  
Old 09-02-2008, 04:38 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Something like:
Code:
Sub App_Start
    str = 
"This is a string: * lskjefklew f* wef wl;efkl;wef * fwel;fkw;lkgweg wegwegweg* WEG* wegjlweg=-3t94=-9t*"
    
regex.New1("\*([^\*]+)\*")
    newStr = 
regex.Replace(str,"<b>$1<\b>")
    
Msgbox(newStr)
End Sub
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Find and Replace JamesC Basic4ppc Wishlist 4 11-18-2008 03:45 PM
RegEx-library - Split ? moster67 Basic4ppc Wishlist 11 09-15-2008 04:51 PM
Problem with Regex HARRY Questions (Windows Mobile) 4 01-10-2008 08:07 AM
Get all links from an html file using regex MM2forever Questions (Windows Mobile) 2 10-13-2007 07:56 AM
Replace encoding UTF 8 by UTF 7 EdQas Questions (Windows Mobile) 6 09-16-2007 04:36 PM


All times are GMT. The time now is 10:21 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0