hi there
i am making a php editor and i wanna ask about 2 things :
1-what is the regex -not like in the msdn ,coz i got notthing from it,- and can i use something else
2-how can i make the *.php files open with my editor only
hi there
i am making a php editor and i wanna ask about 2 things :
1-what is the regex -not like in the msdn ,coz i got notthing from it,- and can i use something else
2-how can i make the *.php files open with my editor only
php editor
Bassey
im not quite sure how you would register the app with the Windows Shell, im sure someone else would know....
however if I find anything, ill be sure to post!
Thanks!
Mr_White
thank man
-shokran-
is there a way i can highlight the php code without using this " regex" thing
coz i got nothing about it :S
Pockey
thanks
this site is gr8
hazz
hi there
i stuck again with this :
( i wanna make it select the text that is finds and then unselect it and putting back the cursor the place it was)
here is a code i made to select the emails it finds but it starts selecting from the 1st of the text
Function ValidateEmail(ByVal email As String) As Boolean
Dim emailRegex As New System.Text.RegularExpressions.Regex( "^( <user>[^@]+)@( <host>.+)$") Dim emailMatch As System.Text.RegularExpressions.Match = emailRegex.Match(email) Me.RichTextBox1.Select(emailMatch.Index, emailMatch.Length) Me.RichTextBox1.SelectionColor = Color.Blue Return emailMatch.Success End FunctionALSO IS THERE ANY GOOD PLACE OR BOOK WHICH CAN TEACH ME HOW TO USE REGEX WITH VB.NET
Xythe
thanks very much
but i am sry that i didn't get the last part :S
i donno i was smart but it is like i am in the middel of a maze without any clue but i got much out here on what is the regex and how to use and that it has some "voodo" syntax or something that i don't understand :s which is makeing me ask all this Qs
i am really sry for my stupidity :S
but can you plz help me more and simplify the last part coz i don't have much about the regex syntax :s
-tryin to find something for the vb.net coz the last paper i read about the regex syntax said that is sometimes differ. from lang to lang :S-
Can you Add me to your MSN Messenger
(j.c.o.d.e.r.x@gmail.com) plz :)
so that we can talk MSN to MSN :)
PJFINTRAX
Jeroen Bransen - J-Thread
There is nothing so fun as searching for an answer only to find that you overlooked it.
#1, I'm not big on books. I found the MSDN Docs for the RegularExpressions namespace to be pretty sufficient if you know how to use the rest of VB.NET.
#2, it's selecting from the start of the text because that's where the match is.
#3, I know that's where the match in because the regex you're using "^( <user>[^@]+)@( <host>.+)$" will only match if the entire string is the email. ^ means "start of string" and $ means "end of string". If you want your expression to match something else, change it. Regexes are powerful but must be very carefully constructed to match exactly what you want, no more and no less.
This tool has been recommended for playing around with regex:
http://tools.osherove.com/CoolTools/Regulator/tabid/185/Default.aspx
Were you to remove the ^ and $ it would match however I think that already your regex is too greedy. My research suggest that this regex might work well for you (I haven't tested it too rigorously).
( <user>\w+(\.\w+)*)@( <host>\w+(\.\w+)+)
where \w = valid word (email) characters A-Z, a-z, 0-9, and the _ character
So a@b.c , a@b.c.d, and a.b@c.d, would all match, however a@b won't match but I don't expect that to be much of a problem.
Oh, one more thing. The reason it was matching your entire string was also because your regex matched all NON @ characters, including spaces, and everything else before the @ and the same for everything after. So all an entire document would need to match your regex was to have a single @ in it somewhere.
Other pitfalls to be aware of. The Match method returns a match even if no match is found so you should check the returned matches Success property to verify that it actually found something or the selection cursor will be reset to 0 every time.
Further refining of the regex should be made to avoid validating crazy email addresses like _@_._. Some zero-width assertions and a lot of other things way above your head would be useful but for now that regex should be fine as long as you don't run into any crafty users going out of their way to feed you bad emails.
Next, since you're gonna run that regex a lot you should just instantiate a RegEx instance and cache it at the form (instance field) or assembly (Shared field) level and make sure it's optimized/compiled. You could even compile it to its own assembly for future use. This would provide better runtime performance than the static methods.
Pyromedic
thanks man
but how can i register my app with the windows shell
Linlin425872
1. For a small program allowing you test regex results: http://weitz.de/regex-coach/
2. Describe using regular expressions: http://etext.virginia.edu/services/helpsheets/unix/regex.html
Hope this helps
Crazy Engineer Kid
thanks man
i am 5 yr programming and i think i am still a beginner :s and i am not familiar with this regex
-i got some code for it but i donno i just wanted to make my own way with my own style-
at least modify it not just retype it or copy and paste coz i want it to be mine project :) coz i got many good ideas for it
can i have your email so we can talk on the Msn
Thanks man
webrod
not really, if you are talking about syntax highlighting, like Visual Studio IDE, then I guess the other way you could use some sort of dictionary to look up the words entered (textchanged event I think) and then select the word text (if found in this dictionary) then color it.
to color the text, be sure to use the RTB control (Rich Text Box).
Regex is ideal to use if you load a file, once loaded, then scan through the text to find your keywords and let regex find the words for you, then you can highlight them.
hope it helps
Atle Bjanes
Other regex docs I recommend:
http://www.regular-expressions.info/
for code highlighting check:
http://www.actiprosoftware.com/Products/DotNet/CodeHighlighter/Default.aspx)cts/DotNet/CodeHighlighter/Default.aspx
Though I've written my own highlighter (not in editor but for HTML export of source files) using Regex and it works fine.
If you're just trying to add PHP to .NET try out:
http://www.php-compiler.net/
hayward_ke
.NET Framework Regular Expressions:
http://msdn2.microsoft.com/en-us/library/hs600312(d=ide).aspx
akin_l
Regex is regular expressions.
Regular expressions allow you to do pattern searches in a string input you provide. It's expensive to use but better to be used in an overall continues use, or something similar to that effect. Example could be when you are using a Search box, you may use regex to build up a pattern to search for text.
http://msdn2.microsoft.com/en-us/library/system.text.regularexpressions.regex.aspx
to open a specific file type with your application, I believe you have to register your application with the Windows Shell.
hope it helps!