Click here to Skip to main content
14,669,072 members
Home » Discussions » C#
   

C#

 
GeneralRe: Winforms Inherited form - Resources Pin
MarkB12327-Aug-20 2:48
MemberMarkB12327-Aug-20 2:48 
GeneralRe: Winforms Inherited form - Resources Pin
OriginalGriff27-Aug-20 3:04
mveOriginalGriff27-Aug-20 3:04 
GeneralRe: Winforms Inherited form - Resources Pin
MarkB12327-Aug-20 3:53
MemberMarkB12327-Aug-20 3:53 
GeneralRe: Winforms Inherited form - Resources Pin
OriginalGriff27-Aug-20 4:22
mveOriginalGriff27-Aug-20 4:22 
GeneralRe: Winforms Inherited form - Resources Pin
MarkB12327-Aug-20 4:40
MemberMarkB12327-Aug-20 4:40 
AnswerRe: Winforms Inherited form - Resources Pin
Mycroft Holmes27-Aug-20 12:09
professionalMycroft Holmes27-Aug-20 12:09 
GeneralRe: Winforms Inherited form - Resources Pin
MarkB12327-Aug-20 22:29
MemberMarkB12327-Aug-20 22:29 
QuestionHow to perform find and replace with condition in C# and/or regex? Pin
Pallavi H Shinde26-Aug-20 7:55
MemberPallavi H Shinde26-Aug-20 7:55 
Hello all. I am asking this for my wikipedia editing. I am not from the background of computer science but I edit wikipedia a lot.

I am using a software called as auto wiki browser to edit: brief intro to AWB - Wikipedia[^] AWB is a very powerful tool. It also supports modules.Wikipedia:AutoWikiBrowser/Custom Modules - Wikipedia[^] also regex.

I am running a find and replace task using awb. I wants to add some rules for skipping.
My exact problem in short: on wikipedia there are many pages called as disambiguation page for example: Robert Abel - Wikipedia[^]

This Robert Abel page lists all the persons named Robert Abel and nothing else. Ideally no wiki page should link to Robert Abel. The pages should link to particular Roberts. For example Robert Abel (animator)[^] or Robert Abel (footballer).

What I wants to do is: AWB makes a list of all the pages linking to Robert Abel (base page). I wants to search for Robert Abel and replace it with Robert Abel (animator). But if the text is "Robert Abel (footballer)" or "Robert Abel (racing driver)" then I wants to skip it.

public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
{
    Skip = false;
    Summary = "fix wikilink";

    ArticleText = ArticleText.Replace("Robert Abel", "Robert Abel (animator)");

    return ArticleText;
}


I tried the above code in AWB module. But if there is already "Robert Abel (animator)" in the article then it addings "Robert Abel (animator) (animator)". I tried to add else parameter but it giving compilation error. This is faulty code:

public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
{
    Skip = false;
    Summary = "fix wikilink";

    ArticleText = ArticleText.Replace("Robert Abel", "Robert Abel (animator)");
if ArticleText = "Robert Abel (animator)" {
                    Skip = true;
                } else {
                    ArticleText.Replace("Robert Abel", "Robert Abel (animator)");
                }
    return ArticleText;
}


Update edit: I thinks it is giving error because of the bracket of (animator) after else. idk.

I wants to add few different rules. example: skip if "A" or "B" or "C" is present. If "D" is present then change it to "E". If "F" is present then change it to "G". If I can get one example then I can do the rest with monkey sees monkey does principle.

The problem comes with text after "Robert Abel". How to tell the program to not to make any changes/skip that one particular instance when there is "Robert Abel (animator)" or "Robert Abel (footballer)", and then to look for next instance of only "Robert Abel"?

Please help me. But I am not from background of computer science so please explain in way that I will understand. I also asked the same question on this same website: How to perform find and replace with condition in C# and/or regex?[^]

modified 26-Aug-20 14:21pm.

AnswerRe: How to perform find and replace with condition in C# and/or regex? Pin
OriginalGriff26-Aug-20 8:00
mveOriginalGriff26-Aug-20 8:00 
GeneralRe: How to perform find and replace with condition in C# and/or regex? Pin
Pallavi H Shinde26-Aug-20 8:16
MemberPallavi H Shinde26-Aug-20 8:16 
GeneralRe: How to perform find and replace with condition in C# and/or regex? Pin
Randor 26-Aug-20 9:41
professional Randor 26-Aug-20 9:41 
GeneralRe: How to perform find and replace with condition in C# and/or regex? Pin
Pallavi H Shinde26-Aug-20 21:11
MemberPallavi H Shinde26-Aug-20 21:11 
AnswerRe: How to perform find and replace with condition in C# and/or regex? Pin
Gerry Schmitz26-Aug-20 13:57
mveGerry Schmitz26-Aug-20 13:57 
GeneralRe: How to perform find and replace with condition in C# and/or regex? Pin
Pallavi H Shinde26-Aug-20 21:16
MemberPallavi H Shinde26-Aug-20 21:16 
GeneralRe: How to perform find and replace with condition in C# and/or regex? Pin
Gerry Schmitz27-Aug-20 3:44
mveGerry Schmitz27-Aug-20 3:44 
QuestionC# Pin
Member 1492367126-Aug-20 7:54
MemberMember 1492367126-Aug-20 7:54 
AnswerRe: C# Pin
OriginalGriff26-Aug-20 7:58
mveOriginalGriff26-Aug-20 7:58 
GeneralRe: C# Pin
Richard Andrew x6426-Aug-20 11:28
professionalRichard Andrew x6426-Aug-20 11:28 
AnswerRe: C# Pin
Gerry Schmitz27-Aug-20 3:54
mveGerry Schmitz27-Aug-20 3:54 
AnswerRe: C# Pin
Exoskeletor2-Sep-20 0:48
MemberExoskeletor2-Sep-20 0:48 
QuestionLooking for a book on C# forms Pin
Brian_TheLion25-Aug-20 21:21
MemberBrian_TheLion25-Aug-20 21:21 
AnswerRe: Looking for a book on C# forms Pin
Richard MacCutchan25-Aug-20 21:23
mveRichard MacCutchan25-Aug-20 21:23 
GeneralRe: Looking for a book on C# forms Pin
Brian_TheLion25-Aug-20 21:35
MemberBrian_TheLion25-Aug-20 21:35 
GeneralRe: Looking for a book on C# forms Pin
Richard MacCutchan25-Aug-20 22:25
mveRichard MacCutchan25-Aug-20 22:25 
AnswerRe: Looking for a book on C# forms Pin
OriginalGriff25-Aug-20 21:37
mveOriginalGriff25-Aug-20 21:37 

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.