|
|
I want to repeat a part of the pattern to match all attributes enclosed between the two braces
the pattern I want to repeat looks like this:
[\n\t\\s]*[a-zA-Z\\-]+[\\s]*:[\\s]*[a-zA-Z\\-]+[\n\t\\s]*
How to repeat this pattern? this pattern allows application to validate only one attribute
like this
color:red;
but if there is a lot of attributes i don't know
How to make the pattern match them all?
Dad
|
|
|
|
|
Regex.Matches returns a MatchCollection , if more than one match is found. I don't see your problem!?!
|
|
|
|
|
Here you go, I even tested it for you...your pattern appears to work fine and dandy:
string input = @"#DTEST
{
border-style:solid;
border-width:thin;
}";
string pattern = "[\n\t\\s]*[a-zA-Z\\-]+[\\s]*:[\\s]*[a-zA-Z\\-]+[\n\t\\s]*";
MatchCollection mc = Regex.Matches(input, pattern, RegexOptions.Multiline | RegexOptions.IgnoreCase);
Console.WriteLine(mc.Count);
foreach (Match m in mc)
{
Console.WriteLine(m.Value.Trim());
}
|
|
|
|
|
Thanks a lot,
I know that the pattern works well in the way you use it for getting the attributes inside
these two braces {} but what I've failed to do is to match the whole rule like this:
#DTEST
{
border-style
: solid ;
border-width : thin ;
position:relative;
right:10px;
left:900px;
width:50px;
}
This is the whole pattern:
[\\.#]?[a-zA-Z0-9_]+[\n\t\\s]*{[\n\t\\s]*[a-zA-Z\\-]+[\\s]*:[\\s]*[a-zA-Z\\-]+[\n\t\\s]*;[\n\t\\s]*}
but it works only if the css rule contains only one attribute like this:
.Red
{
color:Blue;
}
the question is how can I let it match the css rule even if it has multiple attributes.
Dad
|
|
|
|
|
I want to select a member of TabControl by stroking keyboard but not by clicking the mouse on it.So,I think I have to create a shortcut key for that member.Can you tell me how to create it? Thanks
Hello Friends
|
|
|
|
|
with a keyboard event ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
if i understand correctly you want to make a event on e keypress no with a mouse ex. pressing the F* to raise the event that you want.
i think that in the form that you want to do the shortcut you have to enable keyPreview to True and on the keydown event of the form you should write that on what keycode it should raise this event.
ex...
if (e.KeyCode == Keys.F8)
{
write the code...
}
maybe it should help
spaps
|
|
|
|
|
hi,
i get an error when i try to remove the specific row ....which is following
Message = "Rows cannot be programmatically removed unless the DataGridView is data-bound to an IBindingList that supports change notification and allows deletion."
how can i change the data-bound configuration .
|
|
|
|
|
Hi,
I am developing an windows based application in which some print menu is present which prints the project information.
So i am using "PrintPreviewDialog" control in my application. But the problem is when there is no printer installed in my computer then it is not showing the preview.
but in microsoft word and others it is showing the preview so.
How to show print preview when no printer is installed on ur computer or no printer is connected to your computer. At least it should show the print preview. Is there is some method or some property.
I am using printdocument object in it.
Please guide me.
|
|
|
|
|
Is print preview enabled for Wordpad or MS Word on that computer?
I would just install a generic printer driver and it should work. The printer doesn't have to be plugged in to do a print preview.
|
|
|
|
|
Word, Excel is showing the preview.
But my application is not showing preview
|
|
|
|
|
Even i am also facing the same problem.Can anyone please suggest me the solution?
|
|
|
|
|
|
relative to what ?
No.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
|
Sorry for the delayed reply but thank you very much for the useful answer.
Kind Regards,
Mushq
|
|
|
|
|
Very much a beginner C# person.
I need something simple and I'm pretty sure it can be done. I need to go to a website and simply see if a date has changed. I it has I need to pull the date back in. The date always follows the same three words so it will be easy to find.
Thanks for any who can help
dflat4now
|
|
|
|
|
Not sure I fully understand this, but it sounds like you're talking about a specific web page, and you know roughly where to find this date on the specific page. That should be easy enough--just download the content to a string via http, then "find" the date in the string (i.e. by locating the "same three words"), trim the rest away so you just have the date text, then parse this into a DateTime object using either DateTime.Parse, or another (third party) date-parsing algorithm (there are some on CodeProject) depending on the format of the date.
“Time and space can be a bitch.”
–Gushie, Quantum Leap
{o,o}.oO( Looking for a great RSS reader? Try FeedBeast! )
|)””’) Built with home-grown CodeProject components!
-”-”-
|
|
|
|
|
Use WebClient class to download the webpage content. Write a regular expresssion which finds the required date.
|
|
|
|
|
as N a v a n e e t h posted, use regular expresssion, there is software on code project named "EXPRESSo" i think it will be helpful for you to build the regular expressions.
Regards.
Tasleem Arif
|
|
|
|
|
How do I do it? I created a class called "Category" that is essentially built from some strings and an int, and i need to be able to dispose of it when i am done (there are some issues arising from "used" objects not going away)
I am inhereting the IDisposable interface, but i know that does nothing beyonf requiring you to ad a dispose method. any suggestions?
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
Vodstok wrote: I created a class called "Category" that is essentially built from some strings and an int, and i need to be able to dispose of it when i am done
There is nothing to dispose. You only need to use IDisposable if you are using unmanaged resources which you need to clean up, or you are using instances of classes that already implement IDisposable. Strings and ints fall in to neither category. The garbage collector will clean up the object when it is ready to do so.
|
|
|
|
|
ok, well that is a load off. This may be relevant to my problem: the object is being used as a static object. would that cause it to persist even though it has been "instantiated" with another identity? Essentially, the variable name is being reused on another page, but is returning all ofthe same information, even though it should be night and day different.
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
Vodstok wrote: the object is being used as a static object
Do you mean that the class is declared as static:
public static class MyClass
{
}
Vodstok wrote: would that cause it to persist even though it has been "instantiated" with another identity?
I don't understand what you mean by that. A static object, once created, will persist for the life of the application. You don't "instantiate" the object directly, the CLR decides when to do that. It is possible that a static class won't be "instantiated" (actually, for static classes, the term is "initialised") at all.
Vodstok wrote: Essentially, the variable name is being reused on another page, but is returning all ofthe same information, even though it should be night and day different.
If it is static then there is only ever the one "instance" (if you like).
|
|
|
|