Click here to Skip to main content
15,913,361 members
Home / Discussions / C#
   

C#

 
GeneralRe: adding item to listbox Pin
cpkilekofp29-Sep-08 4:34
cpkilekofp29-Sep-08 4:34 
GeneralRe: adding item to listbox Pin
netJP12L29-Sep-08 5:09
netJP12L29-Sep-08 5:09 
GeneralRe: adding item to listbox Pin
cpkilekofp29-Sep-08 6:46
cpkilekofp29-Sep-08 6:46 
GeneralRe: adding item to listbox Pin
netJP12L29-Sep-08 9:34
netJP12L29-Sep-08 9:34 
GeneralRe: adding item to listbox Pin
cpkilekofp29-Sep-08 11:34
cpkilekofp29-Sep-08 11:34 
GeneralRe: adding item to listbox Pin
cpkilekofp29-Sep-08 4:32
cpkilekofp29-Sep-08 4:32 
GeneralRe: adding item to listbox Pin
netJP12L29-Sep-08 4:57
netJP12L29-Sep-08 4:57 
Questionreg expression Pin
nesfrank22-Sep-08 6:23
nesfrank22-Sep-08 6:23 
Currently I have some code that does some searches via the reg expression in c#. I have a fuynction that returns a reg expression that simply strings and clean the string from HTML tags and the function is below(1). This function works just fine. Recently the code has a bug and the bug seems to be related with the following:
- between words there are multiple spaces and/or multiple nbsp so if the user searches for the "this is" it does not give the right matches if in between "this" and "is" may be multiple spaces, combination of amp;nbsp; and spaces and carriage returns. I am trying to do a test and do the code below which works as a test:

string str = "This  is   a test sentese.";
str = Regex.Replace(str, @" ", " "); //Remove nbsp
str = Regex.Replace(str, @"\s+", " "); //Remove duplicate spaces.

but how can I add the above logic in one sentese? how can I add the above logic part of the regular expression that strips the HTML below? Please help.

1. Function that cleans from html:

public static Regex GetRegExpStripHTML()

{

Regex r = new Regex(@"(<\/?)(?iFrown | :( <element>a(bbr|cronym|ddress|pplet|rea)?|b(ase(f" +

@"ont)?|do|ig|lockquote|ody|r|utton)?|c(aption|enter|ite|(o(de" +

@"|l(group)?)))|d(d|el|fn|i(r|v)|l|t)|em|f(ieldset|o(nt|rm)|ra" +

@"me(set)?)|h([1-6]|ead|r|tml)|i(frame|mg|n(put|s)|sindex)?|kb" +

@"d|l(abel|egend|i(nk)?)|m(ap|e(nu|ta))|no(frames|script)|o(bj" +

@"ect|l|pt(group|ion))|p(aram|re)?|q|s(amp|cript|elect|mall|pa" +

@"n|t(r(ike|ong)|yle)|u(b|p))|t(able|body|d|extarea|foot|h|itl" +

@"e|r|t)|u(l)?|var))(\s(?<attr>.+?))*>");

return r;

}
AnswerRe: reg expression Pin
Daniel Grunwald22-Sep-08 6:54
Daniel Grunwald22-Sep-08 6:54 
GeneralRe: reg expression Pin
nesfrank22-Sep-08 7:50
nesfrank22-Sep-08 7:50 
GeneralRe: reg expression Pin
Daniel Grunwald22-Sep-08 7:54
Daniel Grunwald22-Sep-08 7:54 
QuestionShowDialog method not showing the popup in foreground. Pin
PrashantGadhave22-Sep-08 4:45
PrashantGadhave22-Sep-08 4:45 
AnswerRe: ShowDialog method not showing the popup in foreground. Pin
Thomas Stockwell22-Sep-08 6:03
professionalThomas Stockwell22-Sep-08 6:03 
AnswerRe: ShowDialog method not showing the popup in foreground. Pin
Paul Conrad22-Sep-08 6:36
professionalPaul Conrad22-Sep-08 6:36 
GeneralRe: ShowDialog method not showing the popup in foreground. Pin
PrashantGadhave22-Sep-08 6:54
PrashantGadhave22-Sep-08 6:54 
Questionwork with a ssh connection Pin
caradri22-Sep-08 4:45
caradri22-Sep-08 4:45 
AnswerRe: work with a ssh connection Pin
Paul Conrad22-Sep-08 6:35
professionalPaul Conrad22-Sep-08 6:35 
RantRe: work with a ssh connection Pin
caradri22-Sep-08 18:51
caradri22-Sep-08 18:51 
QuestionHow do I set the location of a form? Pin
arnold_w22-Sep-08 4:06
arnold_w22-Sep-08 4:06 
AnswerRe: How do I set the location of a form? Pin
Caio Kinzel Filho22-Sep-08 4:17
Caio Kinzel Filho22-Sep-08 4:17 
AnswerRe: How do I set the location of a form? Pin
DaveyM6922-Sep-08 4:28
professionalDaveyM6922-Sep-08 4:28 
AnswerRe: How do I set the location of a form? Pin
Nouman Bhatti22-Sep-08 7:44
Nouman Bhatti22-Sep-08 7:44 
AnswerRe: How do I set the location of a form? Pin
arnold_w22-Sep-08 21:35
arnold_w22-Sep-08 21:35 
QuestionManagementObject Pin
arkiboys22-Sep-08 3:55
arkiboys22-Sep-08 3:55 
AnswerRe: ManagementObject Pin
Mark Salsbery22-Sep-08 6:35
Mark Salsbery22-Sep-08 6:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.