Vote count:
0
I'm new to C# so I have not much experience.
For a simple experience project I need to find keywords from a sentence which resamble the input I get. It now seems that the solutions is way more complex than I thought it would be, so please forgive my lack of experience or knowledge.
I am getting a string from my datatabse which can have any number of letters and the rest of the string are figures, but the total number of characters from the string must be used for the matching. string ThisIsTheTemplateToLookFor = "AB12345678" And I've got a string with some text: string FromThisStringINeedToFind = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s and here comes the text to find AB54925871";
With "ThisIsTheTemplateToLookFor" probably a regex command must be build to find simular pieces of text. So it needs to find: "AB12345678", "AB87654321" and "AB67812345" etc. The regex must look for the two letters and 8 figures from the sample string. Or in a diffrent situation the "ThisIsTheTemplateToLookFor" string could be "A1234" the regex should find "A1234" "A4321" "A3910" etc.
Or as Tim Schmelter suggested maybe a Levenshtein Distance Algorithm
Sorry for the language as I'm not native english speaking
I think his point is that the search string is different in subtle and as yet not enumerated ways than the string that should be found. In the example, the search string is AB12345678, but the string that should get discovered is AB54925871. My guess is if the search string is AB12345678, then any 10 character substring containing those 10 characters in any order should be found. – hatchet
In the first example AB and any 8 figures should give a result. In the second example A and any 4 figures should give a result.
C# Find substring based on input string
Aucun commentaire:
Enregistrer un commentaire