matrixebiz
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2016
05:44 PM
function to extract text from a pile of returned text
not needed
20 REPLIES 20
belltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2016
06:17 PM
Re: function to extract text from a pile of returned text
' Return array of <item> strings from string containing occurrences of: text=<item>,
'
Function extractTextList (data As String) As Object
list = []
re = CreateObject ("roRegex", ".*?text=([^,]+),(.*)", "s")
ma = re.Match (data)
While ma.Count () > 2
list.Push (ma [1])
ma = re.Match (ma [2])
End While
Return list
End Function
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2016
06:20 PM
Re: function to extract text from a pile of returned text
ifString.split() can get you started:
Brightscript Debugger> ? "blah, blah, blah, blah, text=1234, blah, blah, text=1234, blah, blah, blah, blah".split("text=")
<Component: roArray> =
[
"blah, blah, blah, blah, "
"1234, blah, blah, "
"1234, blah, blah, blah, blah"
]
matrixebiz
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2016
07:15 PM
Re: function to extract text from a pile of returned text
not needed
belltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2016
07:18 PM
Re: function to extract text from a pile of returned text
What are you calling it with?
belltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2016
07:21 PM
Re: function to extract text from a pile of returned text
If you can guarantee that each <item> in text=<item>, is a sequence of digits, you can use this regex:
re = CreateObject ("roRegex", ".*?text=(\d+),(.*)", "s")
matrixebiz
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2016
07:33 PM
Re: function to extract text from a pile of returned text
See below
matrixebiz
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2016
07:46 PM
Re: function to extract text from a pile of returned text
not needed
belltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2016
09:13 PM
Re: function to extract text from a pile of returned text
re = CreateObject ("roRegex", ".*?text=(\d+)[^,]*,(.*)", "s")
should allow a sequence of digits then strip off anything else before the next comma.
matrixebiz
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2016
09:23 PM
Re: function to extract text from a pile of returned text
not needed