#Regex for prefix expressions
20 messages ยท Page 1 of 1 (latest)
Hey, @proud delta!
Please remember to /close this post once your question has been answered!
(^[\+\*\/\-])\s[0-9]\s[0-9]```This works for ```+ 5 5``` but I need a regex that can extend to n length
This covers any thing that starts with a valid operator java ^(\+\s)+|^(\*\s)+|^(\/\s)+|^(\-\s)+ so it covers ```java
/ / /
so it looks like it could start with java ^(\+\s)+|^(\*\s)+|^(\/\s)+|^(\-\s)+ and end with java [0-9]$|[a-z]$|[A-Z]$|[0-9]\s+$|[a-z]\s+$|[A-Z]\s+$ the middle is where it gets complex
can you provide some examples?
Here is a converter https://www.free-online-calculator-use.com/infix-to-prefix-converter.html#
infix is normal 5 +5 = 10 type of math
prefix would be + 5 5
I almost have it, need to figure out this middle
here is what would be needed for the spacing in the middle of the equation java (?<=[a-zA-Z0-9])\s
I need a means of asserting that this squared off portion is true
What are you doing? It's like you think regex is magic or something
What do you mean the end and the middle? How is it different?
so because im working with something you don't understand... im the one who thinks Im working with magic. Your help is not needed ๐
Dude... ^(+\s)+|^(*\s)+|^(/\s)+|^(-\s)+
Yes you're the one working with magic
But I guess I don't understand whether you want to support + + + 5 5 5 5 but not + - / 5 5 5 5
Read this and went offline huh ๐ I almost have it