12-08-24, 10:19 PM
(12-08-24, 01:37 AM)Amir_Alzubidy كتب : اخي الحبيب جزاك الله خير
بارك الله سعيك في خدمة القرآن الكريم
كما لدي رغبة شديدة بأن اكون جزءً من نجاح هذا العمل لو بالقليل
هذه محاولة اتمنى ان تؤدي الغرض
كما اتمنى من الاخوة ممن لديه الخبرة او الطريقة المشاركة لحل هذه المشكلة لنتشارك الاجر
![]()
![]()
PHP كود :
private void btnSearch_Click(object sender, EventArgs e)
{
string searchTerm = txtSearch.Text.Trim();
string filePath = @"QURAN.txt"; // تأكد من تحديث المسار إلى المسار الصحيح للملف
if (string.IsNullOrEmpty(searchTerm))
{
MessageBox.Show("يرجى إدخال كلمة البحث.");
return;
}
if (!File.Exists(filePath))
{
MessageBox.Show("الملف النصي غير موجود.");
return;
}
string content = File.ReadAllText(filePath);
string regexPattern = $@"(\b\w+\b)?\s+\b{Regex.Escape(searchTerm)}\b";
Regex regex = new Regex(regexPattern, RegexOptions.IgnoreCase | RegexOptions.Multiline);
MatchCollection matches = regex.Matches(content);
StringBuilder results = new StringBuilder();
int count = matches.Count;
foreach (Match match in matches)
{
if (match.Success)
{
string previousWord = string.IsNullOrEmpty(match.Groups[1].Value) ? "" : match.Groups[1].Value;
results.AppendLine($"{previousWord} {searchTerm}");
}
}
txtResults.Text = results.ToString();
txtCount.Text = count.ToString();
}
نصرك الله و اعزك و رزقنا و اياك الصحة و العافية
هذا الكود لا يعمل
ربي زدني علما 
