filename_author
to
p>
author_filename
I am using MS Word 2003, and I am trying to use Word’s Find and Replace. I have tried using the wildcard function, but no luck.
Can I only do it programmatically?
([^_]*)_(.*)
This is a C# example:
< /p>
using System;
using System.Text.RegularExpressions;
class Program
{
static void Main()
{< br /> String test = "filename_author";
String result = Regex.Replace(test, @"([^_]*)_(.*)", "$2_$1");
}
}
This is a Python example:
from re import sub
test = "filename_author" ;
result = sub('([^_]*)_(.*)', r'_', test)
Edit: In order to use wildcards in Microsoft Word To do this, use it as a search string:
(<*>)_(<*>)
p>
and replace with:
_
< p>Also, see Add power to Word searches with regular expressions for an explanation of the syntax I used above:
- The asterisk (*) returns all the text in the word.
- The less than and greater than symbols (< >) mark the start and end
of each word, respectively. They
ensure that the search returns a
single word.- The parentheses and the space between them divide the words into distinct groups: (first word) (second word). The parentheses also indicate the order in which you want search to evaluate each expression.
< /div>
Anyone can help me change the regular expression:
filename_author
to
author_filename
I am using MS Word 2003, and I am trying to use Word’s Find and Replace. I have tried using the wildcard function, but no luck.
Can I only do it programmatically?
This is a regular expression:
([^ _]*)_(.*)
This is a C# example:
using System;
using System.Text.RegularExpressions;
class Program
{
static void Main()
{
String test = "filename_author";
String result = Regex.Replace(test, @"([^_]*)_(.*)", "$2_$1");
}
}
This is a Python example:
from re import sub
test = "filename_author";
result = sub('([ ^_]*)_(.*)', r'_', test)
Edit: In order to do this with wildcards in Microsoft Word, please use it as a search string :
(<*>)_(<*>)
and replace with :
_
Also, please refer to Add power to Word searches with regular expressions to get an explanation of the grammar I used above:
- The asterisk (*) returns all the text in the word.
< li>The less than and greater than symbols (< >) mark the start and end
of ea ch word, respectively. They
ensure that the search returns a
single word.- The parentheses and the space between them divide the words into distinct groups: (first word) (second word) . The parentheses also indicate the order in which you want search to evaluate each expression.
WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5474 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC