Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I have some Jquery code like this:
$("a[for_column="+ p_column_name +"]"
Problem is, when p_columns_name is something like this_table.user_name I need to remove everything before the . including the ..
this_table.user_name
.
Is this possible inline?
p_column_name.substring(p_column_name.indexOf('.')+1)
Replace /.*\./ with nothing:
/.*\./
$("a[for_column="+ p_column_name.replace(/.*\./, '') +"]"
.* - everything before the last dot. \. - the dot itself.
.*
\.
Add a comment
You do not neef any regex. Use indexOf with substring:
indexOf
substring
$("a[for_column="+ p_column_name.substring(p_column_name.indexOf('.')+1) +"]"
var p_column_name = "this_table.user_name"; alert(p_column_name.substring(p_column_name.indexOf('.')+1));
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
p_column_name.substring(p_column_name.indexOf('.')+1).