Hello,
I have the following regex to match any ld bc, xxxx statement (I've replaced spaces with underscores for readability):

Code:
_*ld__*bc_*,_*..*

How would I match just the value? For instance, ld bc, 1234, how would I match 1234? Keep in mind that whitespace should not be counted.

Code:
[_\t]*ld\s+bc_*,_*(.+)

Same substitutions as before, but mine allows it to start with tabs and uses d+ instead of dd*
In short, enclose it in parentheses, and, in perl, use $1 (different for C#, I'd assume)
Calcdude's answer is correct. If you're assuming it's a numerical address, though, you should really be using \d+ instead of .+...
Well, it could be a label, or a .equ, not to mention a hex value.
calcdude84se wrote:
Well, it could be a label, or a .equ, not to mention a hex value.
In plaintext, sure, but I'm unclear whether this is before or after he does constant replacement. Smile
Well, we'll have to wait and see Smile
I assume this is for tiDE?
calcdude84se wrote:
Well, we'll have to wait and see Smile
I assume this is for tiDE?
I assume the same, since he wouldn't be using Regex for his on-calc compiler project.
Hello,
Yes, this is for tiDE, and I integrated regex into the assembler so that every command is able to be assembled.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement