Hi All,
I have a fully qualified file name of my project.
var bb = C:\\\\Testing\\BDD\\ABC072_SDS\\ABC072_SDS.mds
I need to get 'ABC072_SDS' from the path and store in a variable to use it further.
How can I use regex to get the required text?
Because 072 is always changing with different project names, I cannot give it as substring. I am looking for a solution that takes the whole ABC072_SDS out without worrying about the digits 072.
Thank you.
","kudosSumWeight":0,"postTime":"2022-05-05T03:26:42.951-07:00","images":{"__typename":"AssociatedImageConnection","edges":[],"totalCount":0,"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"attachments":{"__typename":"AttachmentConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[]},"tags":{"__typename":"TagConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[{"__typename":"TagEdge","cursor":"MjQuMTF8Mi4xfG98MTB8X05WX3wx","node":{"__typename":"Tag","id":"tag:BDD Tests","text":"BDD Tests","time":"2021-10-24T13:34:00.008-07:00","lastActivityTime":null,"messagesCount":null,"followersCount":null}},{"__typename":"TagEdge","cursor":"MjQuMTF8Mi4xfG98MTB8X05WX3wy","node":{"__typename":"Tag","id":"tag:Desktop Testing","text":"Desktop Testing","time":"2015-06-10T03:45:54.639-07:00","lastActivityTime":null,"messagesCount":null,"followersCount":null}}]},"timeToRead":1,"currentRevision":{"__ref":"Revision:revision:233483_2"},"latestVersion":null,"metrics":{"__typename":"MessageMetrics","views":565},"visibilityScope":"PUBLIC","canonicalUrl":null,"seoTitle":null,"seoDescription":null,"isEscalated":null,"placeholder":false,"originalMessageForPlaceholder":null,"messagePolicies":{"__typename":"MessagePolicies","canModerateSpamMessage":{"__typename":"PolicyResult","failureReason":{"__typename":"FailureReason","message":"error.lithium.policies.feature.moderation_spam.action.moderate_entity.allowed.accessDenied","key":"error.lithium.policies.feature.moderation_spam.action.moderate_entity.allowed.accessDenied","args":[]}}},"archivalData":null,"body":"Hi All,
I have a fully qualified file name of my project.
var bb = C:\\\\Testing\\BDD\\ABC072_SDS\\ABC072_SDS.mds
I need to get 'ABC072_SDS' from the path and store in a variable to use it further.
How can I use regex to get the required text?
Because 072 is always changing with different project names, I cannot give it as substring. I am looking for a solution that takes the whole ABC072_SDS out without worrying about the digits 072.
Thank you.
","customFields":[]},"Conversation:conversation:233483":{"__typename":"Conversation","id":"conversation:233483","solved":true,"topic":{"__ref":"ForumTopicMessage:message:233483"},"lastPostingActivityTime":"2022-05-05T11:29:12.963-07:00","lastPostTime":"2022-05-05T11:29:12.963-07:00","unreadReplyCount":2,"isSubscribed":false},"ModerationData:moderation_data:233483":{"__typename":"ModerationData","id":"moderation_data:233483","status":"APPROVED","rejectReason":null,"isReportedAbuse":false,"rejectUser":null,"rejectTime":null,"rejectActorType":null},"Revision:revision:233483_2":{"__typename":"Revision","id":"revision:233483_2","lastEditTime":"2022-05-05T03:30:48.869-07:00"},"ForumReplyMessage:message:233484":{"__typename":"ForumReplyMessage","id":"message:233484","conversation":{"__ref":"Conversation:conversation:233483"},"author":{"__ref":"User:user:93795"},"revisionNum":1,"uid":233484,"depth":1,"hasGivenKudo":false,"subscribed":false,"board":{"__ref":"Forum:board:testcomplete-questions"},"subject":"Re: Getting a substring in a variable out of Project FileName","readOnly":false,"editFrozen":false,"moderationData":{"__ref":"ModerationData:moderation_data:233484"},"parent":{"__ref":"ForumTopicMessage:message:233483"},"body":"Found this method.
var t = Project.FileName;
Log.Message(aqString.SubString(t, 57, 12)); seems to work but don't know if there is something better as here we are counting the index and it may break if the path changes.
Found this method.
var t = Project.FileName;
Log.Message(aqString.SubString(t, 57, 12)); seems to work but don't know if there is something better as here we are counting the index and it may break if the path changes.
Hi,
\n\n
I hope that aqFileSystem.GetFileNameWithoutExtension() is what you are looking for.
\n\n
/discussions/soapui_os/adding-assertions-automatically-to-a-test-case/24568/replies/233484
🎉 NEW API Hub and Insight Hub are here to simplify workflows and help you deliver quality faster. Learn More